about summary refs log tree commit homepage
path: root/Rakefile
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-08 05:03:26 +0000
committerEric Wong <e@80x24.org>2023-01-08 05:05:01 +0000
commitb5ab9be6686aa778a4cfd7622c598736b9c42321 (patch)
treea967297606a1f91f8359e287d5a85ad018e185e3 /Rakefile
parent4356beb8237a92b3902b17f55cfe93d347b593d5 (diff)
parent2c25edb01139365f4754985c1e3494765dd1e5a7 (diff)
downloadmwrap-b5ab9be6686aa778a4cfd7622c598736b9c42321.tar.gz
This contains many changes from https://80x24.org/mwrap-perl.git
commit

* Built-in RCU-friendly version of dlmalloc, no more fragile dlsym(3m)
  resolution of malloc-family functions in the constructor

* Allocations are now backed by O_TMPFILE on $TMPDIR on modern Linux.
  Since mwrap increases memory usage greatly and I needed to use it
  on a system where I needed more VM space but lacked the ability
  to add swap.

* Configurable C backtrace level via MWRAP=bt:$DEPTH where $DEPTH
  is a non-negative integer.  Be careful about increasing it, even
  a depth of 3-4 can be orders-of-magnitude more expensive in
  time and space.  This can be changed dynamically at runtime via
  local HTTP (see below).

* Embedded per-process local-socket-only HTTP server obsoletes
  MwrapRack when combined with mwrap-rproxy from the Perl dist
  (set `MWRAP=socket_dir:/dir/of/sockets')
  See https://80x24.org/mwrap-perl/20221210015518.272576-4-e@80x24.org/
  for more info.

  It now supports downloading CSV (suitable for importing into sqlite 3.32.0+)

* License switched to GPL-3+ to be compatible with GNU binutils
  since we may take code from addr2line in the future.

* libxxhash supported if XXH3_64bits is available.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile52
1 files changed, 52 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..cf4311e
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,52 @@
+# Copyright (C) mwrap hackers <mwrap-public@80x24.org>
+# License: GPL-2.0+ <https://www.gnu.org/licenses/gpl-2.0.txt>
+require 'rake/testtask'
+begin
+  require 'rake/extensiontask'
+  Rake::ExtensionTask.new('mwrap')
+rescue LoadError
+  warn 'rake-compiler not available, cross compiling disabled'
+end
+
+Rake::TestTask.new(:test)
+task 'test-ruby' => :compile
+task :default => :compile
+
+task 'test-httpd': 'lib/mwrap.so' do
+  require 'rbconfig'
+  ENV['RUBY'] = RbConfig.ruby
+  sh "#{ENV['PROVE'] || 'prove'} -v"
+end
+
+task test: %w(test-ruby test-httpd)
+
+c_files = File.readlines('MANIFEST').grep(%r{ext/.*\.[ch]$}).map!(&:chomp!)
+task 'compile:mwrap' => c_files
+
+olddoc = ENV['OLDDOC'] || 'olddoc'
+rdoc = ENV['RDOC'] || 'rdoc'
+task :rsync_docs do
+  require 'fileutils'
+  top = %w(README COPYING LATEST NEWS NEWS.atom.xml)
+  system("git", "set-file-times")
+  dest = ENV["RSYNC_DEST"] || "80x24.org:/srv/80x24/mwrap/"
+  FileUtils.rm_rf('doc')
+  sh "#{olddoc} prepare"
+  sh "#{rdoc} -f dark216" # dark216 requires olddoc 1.7+
+  File.unlink('doc/created.rid') rescue nil
+  File.unlink('doc/index.html') rescue nil
+  FileUtils.cp(top, 'doc')
+  sh "#{olddoc} merge"
+
+  Dir['doc/**/*'].each do |txt|
+    st = File.stat(txt)
+    if st.file?
+      gz = "#{txt}.gz"
+      tmp = "#{gz}.#$$"
+      sh("gzip --rsyncable -9 <#{txt} >#{tmp}")
+      File.utime(st.atime, st.mtime, tmp) # make nginx gzip_static happy
+      File.rename(tmp, gz)
+    end
+  end
+  sh("rsync --chmod=Fugo=r #{ENV['RSYNC_OPT']} -av doc/ #{dest}/")
+end