Skip to content

Commit 8541cbe

Browse files
committed
depends: libX*: --disable-malloc0returnsnull in conf
1 parent 0e75263 commit 8541cbe

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

depends/packages/libX11.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ $(package)_sha256_hash=2aa027e837231d2eeea90f3a4afe19948a6eb4c8b2bec0241eba7dbc8
66
$(package)_dependencies=libxcb xtrans xextproto xproto
77

88
define $(package)_set_vars
9-
$(package)_config_opts=--disable-xkb --disable-static
10-
$(package)_config_opts_linux=--with-pic
9+
# See libXext for --disable-malloc0returnsnull rationale.
10+
$(package)_config_opts=--disable-xkb --disable-static --disable-malloc0returnsnull
11+
$(package)_config_opts_linux=--with-pic
1112
endef
1213

1314
define $(package)_preprocess_cmds

depends/packages/libXext.mk

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,30 @@ $(package)_sha256_hash=b518d4d332231f313371fdefac59e3776f4f0823bcb23cf7c7305bfb5
66
$(package)_dependencies=xproto xextproto libX11 libXau
77

88
define $(package)_set_vars
9-
$(package)_config_opts=--disable-shared
9+
# A number of steps in the autoconfig process implicitly assume that the build
10+
# system and the host system are the same. For example, library components
11+
# want to build and run test programs to determine the behavior of certain
12+
# host system elements. This is clearly impossible when crosscompiling. To
13+
# work around these issues, the --enable-malloc0returnsnull (or
14+
# --disable-malloc0returnsnull, depending on the host system) must be passed
15+
# to configure.
16+
# -- https://www.x.org/wiki/CrossCompilingXorg/
17+
#
18+
# Concretely, between the releases of libXext 1.3.2 and 1.3.3,
19+
# XORG_CHECK_MALLOC_ZERO from xorg-macros was changed to use the autoconf
20+
# cache, expecting cross-compilation environments to seed this cache as there
21+
# is no single correct value when cross compiling (think uclibc, musl, etc.).
22+
# You can see the actual change in commit 72fdc868b56fe2b7bdc9a69872651baeca72
23+
# in the freedesktop/xorg-macros repo.
24+
#
25+
# As a result of this change, if we don't seed the cache and we don't use
26+
# either --{en,dis}able-malloc0returnsnull, the AC_RUN_IFELSE block has no
27+
# optional action-if-cross-compiling argument and configure prints an error
28+
# message and exits as documented in the autoconf manual. Prior to this
29+
# commit, the AC_RUN_IFELSE block had an action-if-cross-compiling argument
30+
# which set the more pessimistic default value MALLOC_ZERO_RETURNS_NULL=yes.
31+
# This is why the flag was not required prior to libXext 1.3.3.
32+
$(package)_config_opts=--disable-static --disable-malloc0returnsnull
1033
endef
1134

1235
define $(package)_preprocess_cmds

0 commit comments

Comments
 (0)