mysociety / xapian-full

Ruby Xapian bindings, including xapian-core
1 stars 2 forks source link

Refactor compiling #7

Closed gbp closed 1 year ago

gbp commented 1 year ago

Modernise compiling extension.

Approach take from https://github.com/flavorjones/ruby-c-extensions-explained#strategy-2b-packaged_tarball

First step towards pre-compiling and packaging Ruby Xapian bindings.

gbp commented 1 year ago

Originally this PR also had:

diff --git a/Rakefile b/Rakefile
index 3a0acba..8711251 100644
--- a/Rakefile
+++ b/Rakefile
@@ -17,6 +17,7 @@ task :core do
       url: "https://oligarchy.co.uk/xapian/#{ver}/xapian-core-#{ver}.tar.xz",
       sha256: '80f86034d2fb55900795481dfae681bfaa10efbe818abad3622cdc0c55e06f88'
     }
+    recipe.patch_files = Dir[File.join(__dir__, 'patches/xapian-core', '*.patch')].sort
     recipe.configure_options = [] # removes MiniPortile defaults

     unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
@@ -36,6 +37,7 @@ task bindings: [:core] do
       url: "https://oligarchy.co.uk/xapian/#{ver}/xapian-bindings-#{ver}.tar.xz",
       sha256: 'e7bf1e4982b91f841289d19214021d88371ca2a6c7304df59049d7da78b83ced'
     }
+    recipe.patch_files = Dir[File.join(__dir__, 'patches/xapian-bindings', '*.patch')].sort
     recipe.configure_options = ['--with-ruby']

     unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
diff --git a/patches/xapian-bindings/1-configure.patch b/patches/xapian-bindings/1-configure.patch
new file mode 100644
index 0000000..bec6023
--- /dev/null
+++ b/patches/xapian-bindings/1-configure.patch
@@ -0,0 +1,11 @@
+--- ./configure
++++ ./configure
+@@ -7730,7 +7730,7 @@
+       # to the OS version, if on x86, and 10.4, the deployment
+       # target defaults to 10.4. Don't you love it?
+       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+-  10.0,*86*-darwin8*|10.0,*-darwin[91]*)
++  10.0,*86*-darwin8*|10.0,*-darwin[912]*)
+     _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+   10.[012][,.]*)
+     _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
diff --git a/patches/xapian-core/1-configure.patch b/patches/xapian-core/1-configure.patch
new file mode 100644
index 0000000..ea6957e
--- /dev/null
+++ b/patches/xapian-core/1-configure.patch
@@ -0,0 +1,11 @@
+--- ./configure
++++ ./configure
+@@ -8260,7 +8260,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
+       # to the OS version, if on x86, and 10.4, the deployment
+       # target defaults to 10.4. Don't you love it?
+       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+-  10.0,*86*-darwin8*|10.0,*-darwin[91]*)
++  10.0,*86*-darwin8*|10.0,*-darwin[912]*)
+     _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+   10.[012][,.]*)
+     _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;

I'm going to drop those patches for Darwin, having tested again they aren't needed anymore.

They originally started out as https://github.com/Garaio-REM/xapian-ruby/pull/7/files which shows how long I'm been working on updating the compilation.