[Buildroot] [PATCH v2] package/git: switch to meson build system
Shubham Chakraborty <[email protected]>
| Newsgroups | net.busybox.buildroot |
|---|---|
| Message-ID | <[email protected]> |
Switching from autotools-package to meson-package fixes build
failures on older glibc toolchains (such as glibc 2.24 without
<sys/random.h>) because Meson checks both symbol and header presence
via compiler.has_header_symbol('sys/random.h', 'getrandom'), avoiding an
unconditional #include <sys/random.h>.
Also add BR2_TOOLCHAIN_HAS_THREADS dependency to package/git/Config.in
because on toolchains without thread support, compilation fails with
'fatal error: pthread.h: No such file or directory' in thread-utils.h
and linking fails with 'cannot find -lpthread'.
Tested with:
utils/test-pkg -a -p git
Signed-off-by: Shubham Chakraborty <[email protected]>
---
Changes v1 -> v2:
- Convert build infrastructure from autotools-package to meson-package
instead of carrying custom C patch (Arnout Vandecappelle).
- Add BR2_TOOLCHAIN_HAS_THREADS dependency to package/git/Config.in.
package/git/Config.in | 5 ++++
package/git/git.mk | 57 +++++++++++++++++++------------------------
2 files changed, 30 insertions(+), 32 deletions(-)
diff --git a/package/git/Config.in b/package/git/Config.in
index d53921d7d5..e8bc2a76c7 100644
--- a/package/git/Config.in
+++ b/package/git/Config.in
@@ -1,6 +1,7 @@
config BR2_PACKAGE_GIT
bool "git"
depends on BR2_USE_MMU # uses fork()
+ depends on BR2_TOOLCHAIN_HAS_THREADS
select BR2_PACKAGE_ZLIB
select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
help
@@ -9,3 +10,7 @@ config BR2_PACKAGE_GIT
projects.
http://git-scm.com
+
+comment "git needs a toolchain w/ threads"
+ depends on BR2_USE_MMU
+ depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/git/git.mk b/package/git/git.mk
index 10ef081223..321e168589 100644
--- a/package/git/git.mk
+++ b/package/git/git.mk
@@ -13,71 +13,64 @@ GIT_CPE_ID_VENDOR = git-scm
GIT_SELINUX_MODULES = apache git xdg
GIT_DEPENDENCIES = zlib $(TARGET_NLS_DEPENDENCIES)
+GIT_CONF_OPTS = \
+ -Dperl=disabled \
+ -Dpython=disabled \
+ -Dgitweb=disabled \
+ -Dtests=false
+
ifeq ($(BR2_PACKAGE_OPENSSL),y)
-GIT_DEPENDENCIES += host-pkgconf openssl
-GIT_CONF_OPTS += --with-openssl
-GIT_MAKE_OPTS += LIB_4_CRYPTO="`$(PKG_CONFIG_HOST_BINARY) --libs libssl libcrypto`"
+GIT_DEPENDENCIES += openssl
+GIT_CONF_OPTS += -Dhttps_backend=openssl
else
-GIT_CONF_OPTS += --without-openssl
+GIT_CONF_OPTS += -Dhttps_backend=none
endif
ifeq ($(BR2_PACKAGE_PCRE2),y)
GIT_DEPENDENCIES += pcre2
-GIT_CONF_OPTS += --with-libpcre2
+GIT_CONF_OPTS += -Dpcre2=enabled
else
-GIT_CONF_OPTS += --without-libpcre2
+GIT_CONF_OPTS += -Dpcre2=disabled
endif
ifeq ($(BR2_PACKAGE_LIBCURL),y)
GIT_DEPENDENCIES += libcurl
-GIT_CONF_OPTS += --with-curl
-GIT_CONF_ENV += \
- ac_cv_prog_CURL_CONFIG=$(STAGING_DIR)/usr/bin/$(LIBCURL_CONFIG_SCRIPTS)
+GIT_CONF_OPTS += -Dcurl=enabled
else
-GIT_CONF_OPTS += --without-curl
+GIT_CONF_OPTS += -Dcurl=disabled
endif
ifeq ($(BR2_PACKAGE_EXPAT),y)
GIT_DEPENDENCIES += expat
-GIT_CONF_OPTS += --with-expat
+GIT_CONF_OPTS += -Dexpat=enabled
else
-GIT_CONF_OPTS += --without-expat
+GIT_CONF_OPTS += -Dexpat=disabled
endif
ifeq ($(BR2_PACKAGE_LIBICONV),y)
GIT_DEPENDENCIES += libiconv
-GIT_CONF_ENV_LIBS += -liconv
-GIT_CONF_OPTS += --with-iconv=$(STAGING_DIR)/usr
-GIT_CONF_ENV += ac_cv_iconv_omits_bom=no
+GIT_CONF_OPTS += -Diconv=enabled
else
-GIT_CONF_OPTS += --without-iconv
+GIT_CONF_OPTS += -Diconv=disabled
endif
ifeq ($(BR2_PACKAGE_TCL),y)
GIT_DEPENDENCIES += tcl
-GIT_CONF_OPTS += --with-tcltk
+GIT_CONF_OPTS += -Dgitk=enabled -Dgit_gui=enabled
else
-GIT_CONF_OPTS += --without-tcltk
+GIT_CONF_OPTS += -Dgitk=disabled -Dgit_gui=disabled
endif
-ifeq ($(BR2_SYSTEM_ENABLE_NLS),)
-GIT_MAKE_OPTS += NO_GETTEXT=1
+ifeq ($(BR2_SYSTEM_ENABLE_NLS),y)
+GIT_CONF_OPTS += -Dgettext=enabled
+else
+GIT_CONF_OPTS += -Dgettext=disabled
endif
-GIT_CFLAGS = $(TARGET_CFLAGS)
-
ifneq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),)
GIT_CFLAGS += -O0
endif
-GIT_CONF_OPTS += CFLAGS="$(GIT_CFLAGS)"
-
-GIT_INSTALL_TARGET_OPTS = $(GIT_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
-
-# assume yes for these tests, configure will bail out otherwise
-# saying error: cannot run test program while cross compiling
-GIT_CONF_ENV += \
- ac_cv_fread_reads_directories=yes \
- ac_cv_snprintf_returns_bogus=yes LIBS='$(GIT_CONF_ENV_LIBS)'
+GIT_CONF_OPTS += -Dc_args="$(TARGET_CFLAGS) $(GIT_CFLAGS)"
-$(eval $(autotools-package))
+$(eval $(meson-package))
--
2.55.0
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot