aboutsummaryrefslogtreecommitdiff
path: root/depends
diff options
context:
space:
mode:
authorCarl Dong <accounts@carldong.me>2019-04-19 17:56:31 -0400
committerCarl Dong <accounts@carldong.me>2019-05-28 11:03:37 -0400
commit8541cbea29f96b756cfb5ec1894d818b4c870924 (patch)
treee325e0c6651dee8068b9a60b8bb9d5177123856f /depends
parent0e752637a26cf75187864a466db9a92540a2d3c8 (diff)
downloadbitcoin-8541cbea29f96b756cfb5ec1894d818b4c870924.tar.xz
depends: libX*: --disable-malloc0returnsnull in conf
Diffstat (limited to 'depends')
-rw-r--r--depends/packages/libX11.mk5
-rw-r--r--depends/packages/libXext.mk25
2 files changed, 27 insertions, 3 deletions
diff --git a/depends/packages/libX11.mk b/depends/packages/libX11.mk
index ea461196f2..f46bd9219e 100644
--- a/depends/packages/libX11.mk
+++ b/depends/packages/libX11.mk
@@ -6,8 +6,9 @@ $(package)_sha256_hash=2aa027e837231d2eeea90f3a4afe19948a6eb4c8b2bec0241eba7dbc8
$(package)_dependencies=libxcb xtrans xextproto xproto
define $(package)_set_vars
-$(package)_config_opts=--disable-xkb --disable-static
-$(package)_config_opts_linux=--with-pic
+ # See libXext for --disable-malloc0returnsnull rationale.
+ $(package)_config_opts=--disable-xkb --disable-static --disable-malloc0returnsnull
+ $(package)_config_opts_linux=--with-pic
endef
define $(package)_preprocess_cmds
diff --git a/depends/packages/libXext.mk b/depends/packages/libXext.mk
index cd59b8c5d8..77f32a340e 100644
--- a/depends/packages/libXext.mk
+++ b/depends/packages/libXext.mk
@@ -6,7 +6,30 @@ $(package)_sha256_hash=b518d4d332231f313371fdefac59e3776f4f0823bcb23cf7c7305bfb5
$(package)_dependencies=xproto xextproto libX11 libXau
define $(package)_set_vars
- $(package)_config_opts=--disable-shared
+ # A number of steps in the autoconfig process implicitly assume that the build
+ # system and the host system are the same. For example, library components
+ # want to build and run test programs to determine the behavior of certain
+ # host system elements. This is clearly impossible when crosscompiling. To
+ # work around these issues, the --enable-malloc0returnsnull (or
+ # --disable-malloc0returnsnull, depending on the host system) must be passed
+ # to configure.
+ # -- https://www.x.org/wiki/CrossCompilingXorg/
+ #
+ # Concretely, between the releases of libXext 1.3.2 and 1.3.3,
+ # XORG_CHECK_MALLOC_ZERO from xorg-macros was changed to use the autoconf
+ # cache, expecting cross-compilation environments to seed this cache as there
+ # is no single correct value when cross compiling (think uclibc, musl, etc.).
+ # You can see the actual change in commit 72fdc868b56fe2b7bdc9a69872651baeca72
+ # in the freedesktop/xorg-macros repo.
+ #
+ # As a result of this change, if we don't seed the cache and we don't use
+ # either --{en,dis}able-malloc0returnsnull, the AC_RUN_IFELSE block has no
+ # optional action-if-cross-compiling argument and configure prints an error
+ # message and exits as documented in the autoconf manual. Prior to this
+ # commit, the AC_RUN_IFELSE block had an action-if-cross-compiling argument
+ # which set the more pessimistic default value MALLOC_ZERO_RETURNS_NULL=yes.
+ # This is why the flag was not required prior to libXext 1.3.3.
+ $(package)_config_opts=--disable-static --disable-malloc0returnsnull
endef
define $(package)_preprocess_cmds