Files
rpi-buildroot/package/Makefile.in
Yann E. MORIN 3a39e706a9 package/Makefile.in: work around buggy buildsystems wrt LDFLAGS
Some buildsystems (or their use of it by packages) will cause flags in
LDFLAGS to be re-orderded, or even dropped, causing some
incomprehensible mayhem... For example, gpsd [0] has this in its
SConscript [1](typoes not mines, for once):

    591 # scons uses gcc, or clang, to link. Thus LDFLAGS does not serve its
    592 # traditional function of providing arguments to ln. LDFLAGS set in the
    593 # environment before running scons get moved into CCFLAGS by scons.
    594 # LDFLAGS set while running scons get ignored.
    [--SNIP--]
    611 for i in ["ARFLAGS",
    612           "CCFLAGS",
    613           "CFLAGS",
    614           "CPPFLAGS",
    615           "CXXFLAGS",
    616           "LDFLAGS",
    617           "LINKFLAGS",
    618           "SHLINKFLAGS",
    619           ]:
    620     if i in os.environ:
    621         # MergeFlags() puts the options where scons wants them, not
    622         # where you asked them to go.
    623         env.MergeFlags(Split(os.getenv(i)))

So, when LDFLAGS (our TARGET_LDFLAGS) contains "-z text"  (without the
quotes), that gets turned into a command line like (line-splitted for
readability):

    [...]/buildroot/output/host/bin/aarch64_be-buildroot-linux-musl-gcc \
        -o gpsd-3.25/drivers/driver_rtcm2.os \
        -c \
        --sysroot=[...]/buildroot/output/host/aarch64_be-buildroot-linux-musl/sysroot \
        -O3 -g0 \
        -z \
        -fPIC -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \
        gpsd-3.25/drivers/driver_rtcm2.c

Notice how there is a lone "-z" without any following keyword.

This then causes a build failure that looks totally unrelated [2]:

    In file included from gpsd-3.25/drivers/../include/gpsd.h:36,
                     from gpsd-3.25/drivers/driver_rtcm2.c:65:
    gpsd-3.25/drivers/../include/os_compat.h:40:8: error: redefinition of ‘struct timespec’
       40 | struct timespec {
          |        ^~~~~~~~
    In file included from [...]/buildroot/output/host/aarch64_be-buildroot-linux-musl/sysroot/usr/include/sys/select.h:16,
                     from gpsd-3.25/drivers/../include/gpsd.h:31:
    [...]/buildroot/output/host/aarch64_be-buildroot-linux-musl/sysroot/usr/include/bits/alltypes.h:237:8: note: originally defined here
      237 | struct timespec { time_t tv_sec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER==4321); long tv_nsec; int :8*(sizeof(time_t)-sizeof(long))*(__BYTE_ORDER!=4321); };
          |        ^~~~~~~~
    gpsd-3.25/drivers/../include/os_compat.h:48:5: error: conflicting types for ‘clock_gettime’; have ‘int(clockid_t,  struct timespec *)’ {aka ‘int(int,  struct timespec *)’}
       48 | int clock_gettime(clockid_t, struct timespec *);
          |     ^~~~~~~~~~~~~
    In file included from gpsd-3.25/drivers/../include/gpsd.h:33:
    [...]/buildroot/output/host/aarch64_be-buildroot-linux-musl/sysroot/usr/include/time.h:104:5: note: previous declaration of ‘clock_gettime’ with type ‘int(clockid_t,  struct timespec *)’ {aka ‘int(int,  struct timespec *)’}
      104 | int clock_gettime (clockid_t, struct timespec *);
          |     ^~~~~~~~~~~~~
    scons: *** [gpsd-3.25/drivers/driver_rtcm2.os] Error 1
    scons: building terminated because of errors.
    make[1]: *** [package/pkg-generic.mk:289: [...]/buildroot/output/build/gpsd-3.25/.stamp_built] Error 2
    make: *** [Makefile:83: _all] Error 2

Although undocumented, neither in gcc not ld (clang unchecked by lack of
a clang toolchain here, and by lack of clang knowledge), -z accepts the
keyword to be snatch-glued onto it, like -zkeyword, rather than be
spearated with a space. So, use that to pass -ztext.

Fixes:
    http://autobuild.buildroot.org/results/c03/c039989947b960ac6af17c87090366abc26dcb6d/
    http://autobuild.buildroot.net/results/bc35d3e7b0e8c59c776652070650af3c749250ee/

[0] Our other scons-based package, mongodb, does not build for another
reason that probably hides the same issue as seen with gpsd.

[1] As explained in gpsd's SConscript (se above), Scons does play tricks
with variables:
    https://scons.org/doc/production/HTML/scons-man.html#f-MergeFlags
    https://scons.org/doc/production/HTML/scons-man.html#f-ParseFlags

Quoting:
    Flag values are translated according to the prefix found, and added
    to the following construction variables:
    [...]
    -Wl,                    LINKFLAGS
    [...]
    -                       CCFLAGS
    [...]
    Any other strings not associated with options are assumed to be the
    names of libraries and added to the $LIBS construction variable.

So in our case, it finds that -z is an unknown option that matches the
'-' prefix, so it is added to CFLAGS, while 'text' is a string on its
own, so added to LIBS, and thus it would try to link with -ltext
(supposedly, because we do not even go that far). Funnily enough, we can
se that "-Wl," is a known option prefix, that is added to LINKFLAGS (to
properly be used with gcc or clang, not ld).

As a consequence, gpsd's buildsystem does drop -ztext from the link
flags, and only passes it to the compile flags, which brings us back to
before we banned textrels in a1a2f498d7 (package/Makefile.in: ban
textrels on musl toolchains). Fixing gpsd is a task for another,
separate patch...

[2] I spent quite some time to look at recent, time-related changes in
Buildroot, especially due to the infamous time64_t issues... Alas, that
was not related, and only a git-bisect pinpointed the actual issue. Poor
polar bears...

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: J. Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-by: J. Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-08-10 00:01:00 +02:00

463 lines
15 KiB
Makefile

ifndef MAKE
MAKE := make
endif
ifndef HOSTMAKE
HOSTMAKE = $(MAKE)
endif
HOSTMAKE := $(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make)
# If BR2_JLEVEL is 0, scale the maximum concurrency with the number of
# CPUs. An additional job is used in order to keep processors busy
# while waiting on I/O.
# If the number of processors is not available, assume one.
ifeq ($(BR2_JLEVEL),0)
PARALLEL_JOBS := $(shell echo \
$$((1 + `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
else
PARALLEL_JOBS := $(BR2_JLEVEL)
endif
# Only build one job at a time, *and* to not randomise goals and
# prerequisites ordering in make 4.4+
MAKE1 := $(HOSTMAKE) -j1 $(if $(findstring --shuffle,$(MAKEFLAGS)),--shuffle=none)
override MAKE = $(HOSTMAKE) \
$(if $(findstring j,$(filter-out --%,$(MAKEFLAGS))),,-j$(PARALLEL_JOBS))
ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
TARGET_VENDOR = $(call qstrip,$(BR2_TOOLCHAIN_BUILDROOT_VENDOR))
else
TARGET_VENDOR = buildroot
endif
# Sanity checks
ifeq ($(TARGET_VENDOR),)
$(error BR2_TOOLCHAIN_BUILDROOT_VENDOR is not allowed to be empty)
endif
ifeq ($(TARGET_VENDOR),unknown)
$(error BR2_TOOLCHAIN_BUILDROOT_VENDOR cannot be 'unknown'. \
It might be confused with the native toolchain)
endif
# Compute GNU_TARGET_NAME
GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI)
# FLAT binary format needs uclinux, except RISC-V which needs the
# regular linux name.
ifeq ($(BR2_BINFMT_FLAT):$(BR2_riscv),y:)
TARGET_OS = uclinux
else
TARGET_OS = linux
endif
ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
LIBC = uclibc
else ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
LIBC = musl
else ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
LIBC = gnu
else ifeq ($(BR_BUILDING),y)
# This happens if there is a bug in Buildroot that allows an
# architecture configuration that isn't supported by any library.
$(error No C library enabled, this is not possible.)
endif
# The ABI suffix is a bit special on ARM, as it needs to be
# -uclibcgnueabi for uClibc EABI, and -gnueabi for glibc EABI.
# This means that the LIBC and ABI aren't strictly orthogonal,
# which explains why we need the test on LIBC below.
ifeq ($(BR2_arm)$(BR2_armeb),y)
ifeq ($(LIBC),uclibc)
ABI = gnueabi
else
ABI = eabi
endif
ifeq ($(BR2_ARM_EABIHF),y)
ABI := $(ABI)hf
endif
endif
# For FSL PowerPC there's SPE
ifeq ($(BR2_POWERPC_CPU_HAS_SPE),y)
ABI = spe
# MPC8540s are e500v1 with single precision FP
ifeq ($(BR2_powerpc_8540),y)
TARGET_ABI += -mabi=spe -mfloat-gprs=single -Wa,-me500
endif
ifeq ($(BR2_powerpc_8548),y)
TARGET_ABI += -mabi=spe -mfloat-gprs=double -Wa,-me500x2
endif
ifeq ($(BR2_powerpc_e500mc),y)
TARGET_ABI += -mabi=spe -mfloat-gprs=double -Wa,-me500mc
endif
endif
# Use longcalls option for Xtensa globally.
# The 'longcalls' option allows calls across a greater range of addresses,
# and is required for some packages. While this option can degrade both
# code size and performance, the linker can usually optimize away the
# overhead when a call ends up within a certain range.
#
# Use auto-litpools for Xtensa globally.
# Collecting literals into separate section can be advantageous if that
# section is placed into DTCM at link time. This is applicable for code
# running on bare metal, but makes no sense under linux, where userspace
# is isolated from the physical memory details. OTOH placing literals into
# separate section breaks build of huge source files, because l32r
# instruction can only access literals in 256 KBytes range.
#
ifeq ($(BR2_xtensa),y)
TARGET_ABI += -mlongcalls -mauto-litpools
endif
STAGING_SUBDIR = $(GNU_TARGET_NAME)/sysroot
STAGING_DIR = $(HOST_DIR)/$(STAGING_SUBDIR)
ifeq ($(BR2_OPTIMIZE_0),y)
TARGET_OPTIMIZATION = -O0
endif
ifeq ($(BR2_OPTIMIZE_1),y)
TARGET_OPTIMIZATION = -O1
endif
ifeq ($(BR2_OPTIMIZE_2),y)
TARGET_OPTIMIZATION = -O2
endif
ifeq ($(BR2_OPTIMIZE_3),y)
TARGET_OPTIMIZATION = -O3
endif
ifeq ($(BR2_OPTIMIZE_G),y)
TARGET_OPTIMIZATION = -Og
endif
ifeq ($(BR2_OPTIMIZE_S),y)
TARGET_OPTIMIZATION = -Os
endif
ifeq ($(BR2_OPTIMIZE_FAST),y)
TARGET_OPTIMIZATION = -Ofast
endif
ifeq ($(BR2_ENABLE_DEBUG),)
TARGET_DEBUGGING = -g0
endif
ifeq ($(BR2_DEBUG_1),y)
TARGET_DEBUGGING = -g1
endif
ifeq ($(BR2_DEBUG_2),y)
TARGET_DEBUGGING = -g2
endif
ifeq ($(BR2_DEBUG_3),y)
TARGET_DEBUGGING = -g3
endif
TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
# musl's dynamic loader doesn't support DT_TEXTREL, which results in a runtime
# crash if it gets used. The "-z text" linker option issues a build-time error
# when DT_TEXREL is used, so we capture the problem earlier.
#
# See also: https://www.openwall.com/lists/musl/2020/09/25/4
#
# NOTE: We're using "-ztext" instead of "-Wl,-z,text" here, because some
# packages pass TARGET_LDFLAGS directly to ld rather than gcc, and ld doesn't
# support -Wl,[...]. -z is supported by both gcc and clang, so it probably
# won't cause us problems.
#
# We're using "-ztext" instead of "-z text" here, because some buildsystems
# (like scons, for gpsd) will reorder and/or drop LDFLAGS, causing a lone
# "-z" to be passed and the "text" keyword to be dropped otherwise. Both
# gcc and ld supports that, so it probably won't cause us problems.
ifeq ($(BR2_TOOLCHAIN_USES_MUSL):$(BR2_STATIC_LIBS),y:)
TARGET_LDFLAGS += -ztext
endif
# By design, _FORTIFY_SOURCE requires gcc optimization to be enabled.
# Therefore, we need to pass _FORTIFY_SOURCE and the optimization level
# through the same mechanism, i.e currently through CFLAGS. Passing
# _FORTIFY_SOURCE through the wrapper and the optimization level
# through CFLAGS would not work, because CFLAGS are sometimes
# ignored/overridden by packages, but the flags passed by the wrapper
# are enforced: this would cause _FORTIFY_SOURCE to be used without any
# optimization level, leading to a build / configure failure. So we keep
# passing _FORTIFY_SOURCE and the optimization level both through CFLAGS.
ifeq ($(BR2_FORTIFY_SOURCE_1),y)
TARGET_HARDENED += -D_FORTIFY_SOURCE=1
else ifeq ($(BR2_FORTIFY_SOURCE_2),y)
TARGET_HARDENED += -D_FORTIFY_SOURCE=2
else ifeq ($(BR2_FORTIFY_SOURCE_3),y)
TARGET_HARDENED += -D_FORTIFY_SOURCE=3
endif
TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
ifeq ($(BR2_TIME_BITS_64),y)
TARGET_CPPFLAGS += -D_TIME_BITS=64
endif
TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_HARDENED)
TARGET_CXXFLAGS = $(TARGET_CFLAGS)
TARGET_FCFLAGS = $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79509
ifeq ($(BR2_m68k_cf),y)
TARGET_CFLAGS += -fno-dwarf2-cfi-asm
TARGET_CXXFLAGS += -fno-dwarf2-cfi-asm
endif
ifeq ($(BR2_BINFMT_FLAT),y)
ifeq ($(BR2_riscv),y)
TARGET_CFLAGS += -fPIC
endif
ELF2FLT_FLAGS = $(if $($(PKG)_FLAT_STACKSIZE),\
-Wl$(comma)-elf2flt="-r -s$($(PKG)_FLAT_STACKSIZE)",\
-Wl$(comma)-elf2flt=-r)
TARGET_CFLAGS += $(ELF2FLT_FLAGS)
TARGET_CXXFLAGS += $(ELF2FLT_FLAGS)
TARGET_FCFLAGS += $(ELF2FLT_FLAGS)
TARGET_LDFLAGS += $(ELF2FLT_FLAGS)
endif
ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
TARGET_CROSS = $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-
else
TARGET_CROSS = $(HOST_DIR)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
endif
# gcc-4.7 and later ships with wrappers that will automatically pass
# arguments to the binutils tools. Those are paths to necessary linker
# plugins.
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7),y)
TARGET_GCC_WRAPPERS_PREFIX = gcc-
endif
# Define TARGET_xx variables for all common binutils/gcc
TARGET_AR = $(TARGET_CROSS)$(TARGET_GCC_WRAPPERS_PREFIX)ar
TARGET_AS = $(TARGET_CROSS)as
TARGET_CC = $(TARGET_CROSS)gcc
TARGET_CPP = $(TARGET_CROSS)cpp
TARGET_CXX = $(TARGET_CROSS)g++
TARGET_FC = $(TARGET_CROSS)gfortran
TARGET_LD = $(TARGET_CROSS)ld
TARGET_NM = $(TARGET_CROSS)$(TARGET_GCC_WRAPPERS_PREFIX)nm
TARGET_RANLIB = $(TARGET_CROSS)$(TARGET_GCC_WRAPPERS_PREFIX)ranlib
TARGET_READELF = $(TARGET_CROSS)readelf
TARGET_OBJCOPY = $(TARGET_CROSS)objcopy
TARGET_OBJDUMP = $(TARGET_CROSS)objdump
ifeq ($(BR2_STRIP_strip),y)
STRIP_STRIP_DEBUG := --strip-debug
TARGET_STRIP = $(TARGET_CROSS)strip
STRIPCMD = $(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
else
TARGET_STRIP = /bin/true
STRIPCMD = $(TARGET_STRIP)
endif
INSTALL := $(shell which install || type -p install)
UNZIP := $(shell which unzip || type -p unzip) -q
APPLY_PATCHES = TAR="$(TAR)" PATH=$(HOST_DIR)/bin:$$PATH support/scripts/apply-patches.sh $(if $(QUIET),-s)
HOST_CPPFLAGS = -I$(HOST_DIR)/include
HOST_CFLAGS ?= -O2
HOST_CFLAGS += $(HOST_CPPFLAGS)
HOST_CXXFLAGS += $(HOST_CFLAGS)
HOST_LDFLAGS += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
# host-intltool should be executed with the system perl, so we save
# the path to the system perl, before a host-perl built by Buildroot
# might get installed into $(HOST_DIR)/bin and therefore appears
# in our PATH. This system perl will be used as INTLTOOL_PERL.
export PERL=$(shell which perl)
# host-intltool needs libxml-parser-perl, which Buildroot installs in
# $(HOST_DIR)/lib/perl, so we must make sure that the system perl
# finds this perl module by exporting the proper value for PERL5LIB.
export PERL5LIB=$(HOST_DIR)/lib/perl
TARGET_MAKE_ENV = \
GIT_DIR=. \
PATH=$(BR_PATH)
TARGET_CONFIGURE_OPTS = \
$(TARGET_MAKE_ENV) \
AR="$(TARGET_AR)" \
AS="$(TARGET_AS)" \
LD="$(TARGET_LD)" \
NM="$(TARGET_NM)" \
CC="$(TARGET_CC)" \
GCC="$(TARGET_CC)" \
CPP="$(TARGET_CPP)" \
CXX="$(TARGET_CXX)" \
FC="$(TARGET_FC)" \
F77="$(TARGET_FC)" \
RANLIB="$(TARGET_RANLIB)" \
READELF="$(TARGET_READELF)" \
STRIP="$(TARGET_STRIP)" \
OBJCOPY="$(TARGET_OBJCOPY)" \
OBJDUMP="$(TARGET_OBJDUMP)" \
AR_FOR_BUILD="$(HOSTAR)" \
AS_FOR_BUILD="$(HOSTAS)" \
CC_FOR_BUILD="$(HOSTCC)" \
GCC_FOR_BUILD="$(HOSTCC)" \
CXX_FOR_BUILD="$(HOSTCXX)" \
LD_FOR_BUILD="$(HOSTLD)" \
CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \
CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
CXXFLAGS_FOR_BUILD="$(HOST_CXXFLAGS)" \
LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
FCFLAGS_FOR_BUILD="$(HOST_FCFLAGS)" \
DEFAULT_ASSEMBLER="$(TARGET_AS)" \
DEFAULT_LINKER="$(TARGET_LD)" \
CPPFLAGS="$(TARGET_CPPFLAGS)" \
CFLAGS="$(TARGET_CFLAGS)" \
CXXFLAGS="$(TARGET_CXXFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
FCFLAGS="$(TARGET_FCFLAGS)" \
FFLAGS="$(TARGET_FCFLAGS)" \
PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
STAGING_DIR="$(STAGING_DIR)" \
INTLTOOL_PERL=$(PERL)
HOST_MAKE_ENV = \
GIT_DIR=. \
PATH=$(BR_PATH) \
PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
PKG_CONFIG_SYSROOT_DIR="/" \
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig"
HOST_CONFIGURE_OPTS = \
$(HOST_MAKE_ENV) \
AR="$(HOSTAR)" \
AS="$(HOSTAS)" \
LD="$(HOSTLD)" \
NM="$(HOSTNM)" \
CC="$(HOSTCC)" \
GCC="$(HOSTCC)" \
CXX="$(HOSTCXX)" \
CPP="$(HOSTCPP)" \
OBJCOPY="$(HOSTOBJCOPY)" \
RANLIB="$(HOSTRANLIB)" \
CPPFLAGS="$(HOST_CPPFLAGS)" \
CFLAGS="$(HOST_CFLAGS)" \
CXXFLAGS="$(HOST_CXXFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
INTLTOOL_PERL=$(PERL)
# This is extra environment we can not export ourselves (eg. because some
# packages use that variable internally, eg. uboot), so we have to
# explicitly pass it to user-supplied external hooks (eg. post-build,
# post-images)
EXTRA_ENV = \
PATH=$(BR_PATH) \
BR2_DL_DIR=$(BR2_DL_DIR) \
BUILD_DIR=$(BUILD_DIR) \
CONFIG_DIR=$(CONFIG_DIR) \
O=$(CANONICAL_O) \
PARALLEL_JOBS=$(PARALLEL_JOBS)
################################################################################
# settings we need to pass to configure
# does unaligned access trap?
BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=yes
ifeq ($(BR2_i386),y)
BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
endif
ifeq ($(BR2_x86_64),y)
BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
endif
ifeq ($(BR2_m68k),y)
BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
endif
ifeq ($(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),y)
BR2_AC_CV_TRAP_CHECK = ac_cv_lbl_unaligned_fail=no
endif
ifeq ($(BR2_ENDIAN),"BIG")
BR2_AC_CV_C_BIGENDIAN = ac_cv_c_bigendian=yes
else
BR2_AC_CV_C_BIGENDIAN = ac_cv_c_bigendian=no
endif
# AM_GNU_GETTEXT misdetects musl gettext support.
# musl currently implements api level 1 and 2 (basic + ngettext)
# http://www.openwall.com/lists/musl/2015/04/16/3
#
# These autoconf variables should only be pre-seeded when the minimal
# gettext implementation of musl is used. When the full blown
# implementation provided by gettext libintl is used, auto-detection
# works fine, and pre-seeding those values is actually wrong.
ifeq ($(BR2_TOOLCHAIN_USES_MUSL):$(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y:)
BR2_GT_CV_FUNC_GNUGETTEXT_LIBC = \
gt_cv_func_gnugettext1_libc=yes \
gt_cv_func_gnugettext2_libc=yes
endif
TARGET_CONFIGURE_ARGS = \
$(BR2_AC_CV_TRAP_CHECK) \
ac_cv_func_mmap_fixed_mapped=yes \
ac_cv_func_memcmp_working=yes \
ac_cv_have_decl_malloc=yes \
gl_cv_func_malloc_0_nonnull=yes \
ac_cv_func_malloc_0_nonnull=yes \
ac_cv_func_calloc_0_nonnull=yes \
ac_cv_func_realloc_0_nonnull=yes \
lt_cv_sys_lib_search_path_spec="" \
$(BR2_AC_CV_C_BIGENDIAN) \
$(BR2_GT_CV_FUNC_GNUGETTEXT_LIBC)
################################################################################
ifeq ($(BR2_SYSTEM_ENABLE_NLS),y)
NLS_OPTS = --enable-nls
TARGET_NLS_DEPENDENCIES = host-gettext
ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
TARGET_NLS_DEPENDENCIES += gettext
TARGET_NLS_LIBS += -lintl
endif
else
NLS_OPTS = --disable-nls
endif
# We need anything that is invalid. Traditionally, we'd have used 'false' (and
# we did so in the past). However, that breaks libtool for packages that have
# optional C++ support (e.g. gnutls), because libtool will *require* a *valid*
# C++ preprocessor as long as CXX is not 'no'.
# Now, whether we use 'no' or 'false' for CXX as the same side effect: it is an
# invalid C++ compiler, and thus will cause detection of C++ to fail (which is
# expected and what we want), while at the same time taming libtool into
# silence.
ifneq ($(BR2_INSTALL_LIBSTDCPP),y)
TARGET_CONFIGURE_OPTS += CXX=no
endif
ifeq ($(BR2_STATIC_LIBS),y)
SHARED_STATIC_LIBS_OPTS = --enable-static --disable-shared
TARGET_CFLAGS += -static
TARGET_CXXFLAGS += -static
TARGET_FCFLAGS += -static
TARGET_LDFLAGS += -static
else ifeq ($(BR2_SHARED_LIBS),y)
SHARED_STATIC_LIBS_OPTS = --disable-static --enable-shared
else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
SHARED_STATIC_LIBS_OPTS = --enable-static --enable-shared
endif
# Used by our binutils patches.
export BR_COMPILER_PARANOID_UNSAFE_PATH=enabled
include package/pkg-download.mk
include package/pkg-autotools.mk
include package/pkg-cmake.mk
include package/pkg-luarocks.mk
include package/pkg-perl.mk
include package/pkg-python.mk
include package/pkg-virtual.mk
include package/pkg-generic.mk
include package/pkg-kconfig.mk
include package/pkg-rebar.mk
include package/pkg-kernel-module.mk
include package/pkg-waf.mk
include package/pkg-golang.mk
include package/pkg-meson.mk
include package/pkg-qmake.mk
include package/pkg-cargo.mk