diff --git a/srcpkgs/notmuch/patches/0008-fix-cross-for-ruby-bindings.patch b/srcpkgs/notmuch/patches/0008-fix-cross-for-ruby-bindings.patch new file mode 100644 index 00000000000..02fea34bf9b --- /dev/null +++ b/srcpkgs/notmuch/patches/0008-fix-cross-for-ruby-bindings.patch @@ -0,0 +1,36 @@ +diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb +index d914537c..aae1d2fd 100644 +--- a/bindings/ruby/extconf.rb ++++ b/bindings/ruby/extconf.rb +@@ -18,9 +18,31 @@ if not ENV['LIBNOTMUCH'] + exit 1 + end + ++# Use cross-compiler toolchain ++if ENV['_TARGET_PLATFORM'] ++ RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC'] ++ RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['CXX'] if ENV['CXX'] ++ RbConfig::MAKEFILE_CONFIG['LD'] = ENV['LD'] if ENV['LD'] ++ RbConfig::MAKEFILE_CONFIG['AR'] = ENV['AR'] if ENV['AR'] ++ RbConfig::MAKEFILE_CONFIG['CFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS'] ++ RbConfig::MAKEFILE_CONFIG['LDFLAGS'] = ENV['LDFLAGS'] if ENV['LDFLAGS'] ++end ++ + $LOCAL_LIBS += ENV['LIBNOTMUCH'] + $LIBS += " -ltalloc" + + # Create Makefile + dir_config('notmuch') + create_makefile('notmuch') ++ ++# Fix makefile definitions for cross compile ++if ENV['_TARGET_PLATFORM'] ++ system("sed -i 's|^V =.*|V = 1|' Makefile") ++ system("sed -i 's|^CFLAGS.*|CFLAGS = \$(CCDLFLAGS) $(VOID_TARGET_CFLAGS) \$(ARCH_FLAG)|' Makefile") ++ system("sed -i 's|^topdir.*|topdir = $(XBPS_CROSS_BASE)/usr/include/ruby-\$(ruby_version)|' Makefile") ++ system("sed -i 's|^hdrdir.*|hdrdir = $(XBPS_CROSS_BASE)/usr/include/ruby-\$(ruby_version)|' Makefile") ++ system("sed -i 's|^arch_hdrdir.*|arch_hdrdir = $(XBPS_CROSS_BASE)/usr/include/ruby-\$(ruby_version)/\$(arch)|' Makefile") ++ system("sed -i 's|^arch =.*|arch = $(_TARGET_PLATFORM)|' Makefile") ++ system("sed -i 's|^dldflags =.*|dldflags = $(LDFLAGS)|' Makefile") ++ system("sed -i 's|^libdir =.*|libdir = $(exec_prefix)/lib$(XBPS_TARGET_WORDSIZE)|' Makefile") ++end diff --git a/srcpkgs/notmuch/template b/srcpkgs/notmuch/template index 5f9631d805d..22d76f99a3f 100644 --- a/srcpkgs/notmuch/template +++ b/srcpkgs/notmuch/template @@ -9,9 +9,9 @@ configure_args="--prefix=/usr --emacsetcdir=/usr/share/emacs/site-lisp/notmuch" hostmakedepends="perl pkg-config python3-Sphinx python3-devel texinfo desktop-file-utils emacs gnupg python3-setuptools python3-cffi - python3-build python3-installer doxygen" + python3-build python3-installer doxygen ruby-devel" makedepends="bash-completion gmime3-devel talloc-devel xapian-core-devel - python3-cffi" + python3-cffi ruby-devel" depends="gmime3>=3.2.7" checkdepends="python3-pytest mdocml dtach gdb tar xz xapian-core openssl" @@ -32,14 +32,17 @@ make_check="ci-skip" # dtach based tests fail in CI due to no pty # gpgme is optional dependency conflicts="gpgme<1.14.0_1" subpackages="libnotmuch libnotmuch-devel notmuch-mutt - notmuch-python3 python3-notmuch2" - -if [ ! "$CROSS_BUILD" ]; then - makedepends+=" ruby-devel" - subpackages+=" notmuch-ruby" -fi + notmuch-python3 python3-notmuch2 notmuch-ruby" do_build() { + if [ "$CROSS_BUILD" ]; then + _TARGET_PLATFORM="$(ruby -r \ + $(find ${XBPS_CROSS_BASE}/usr/lib/ruby -iname rbconfig.rb) \ + -e 'puts RbConfig::CONFIG["arch"]' 2>/dev/null)" + VOID_TARGET_CFLAGS="$CFLAGS" + export _TARGET_PLATFORM XBPS_CROSS_BASE VOID_TARGET_CFLAGS \ + XBPS_TARGET_WORDSIZE + fi make ${makejobs} make -C contrib/notmuch-mutt cd ${wrksrc}/bindings/python-cffi @@ -119,6 +122,14 @@ python3-notmuch2_package() { notmuch-ruby_package() { short_desc+=" - Ruby bindings" pkg_install() { + if [ "$CROSS_BUILD" ]; then + _TARGET_PLATFORM="$(ruby -r \ + $(find ${XBPS_CROSS_BASE}/usr/lib/ruby -iname rbconfig.rb) \ + -e 'puts RbConfig::CONFIG["arch"]' 2>/dev/null)" + VOID_TARGET_CFLAGS="$CFLAGS" + export _TARGET_PLATFORM XBPS_CROSS_BASE VOID_TARGET_CFLAGS \ + XBPS_TARGET_WORDSIZE + fi make DESTDIR=${PKGDESTDIR} -C bindings/ruby install } }