From: Arran Cudbard-Bell Date: Tue, 28 Jun 2022 15:08:12 +0000 (-0500) Subject: Fix building libfreeradius-util under emscripten X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba6fa8bbd10a19a327032a69594eb3c3e8905f74;p=thirdparty%2Ffreeradius-server.git Fix building libfreeradius-util under emscripten --- diff --git a/scripts/boiler.mk b/scripts/boiler.mk index e7f71887d41..64cfd474cef 100644 --- a/scripts/boiler.mk +++ b/scripts/boiler.mk @@ -448,23 +448,26 @@ define INCLUDE_SUBMAKEFILE # If we link to FOO, and FOO itself links to things, then we also link to the things # which FOO needs. That way we don't have to manually specify the recursive library # references. - $${TGT}_PREREQS := $$(strip $$(call uniq,$$(foreach x,$${TGT_PREREQS},$$(or $${$${x}_PREREQS},) $${x}))) + $${TGT}_PREREQS := $$(strip $$(call uniq,$$(foreach x,$${TGT_PREREQS},$$(or $${$${x}_PREREQS},) $${x}))) $${TGT}_PRLIBS := $$(addprefix $${BUILD_DIR}/lib/,$$(filter %.a %.la %.${TARGET_LIB_EXT},$${$${TGT}_PREREQS})) # If it's an EXE, ensure that transitive library linking works. # i.e. we build libfoo.a which in turn requires -lbar. So, the executable # has to be linked to both libfoo.a and -lbar. - ifeq "$${$${TGT}_SUFFIX}" ".${TARGET_EXE_EXT}" - $${TGT}_LDLIBS += $$(filter-out %.a %.la %.${TARGET_LIB_EXT},$${$${TGT_PREREQS}_LDLIBS}) - - # - # OSX does lazy linking by default. We want to over-ride that for binaries. - # That way we catch errors at compile time, and not at run time. - # - ifneq "$(findstring apple-darwin,$(TARGET_SYSTEM))" "" - $${TGT}_LDFLAGS += -Wl,-undefined -Wl,error - endif - endif + ifeq "$${$${TGT}_SUFFIX}" ".${TARGET_EXE_EXT}" + # This breaks compilation by listing the same libraries multiple times, jlibtool either + # needs to be made smarter to filter out the duplicates, or we need to find a way of + # doing it here. +# $${TGT}_LDLIBS += $$(filter-out %.a %.la %.${TARGET_LIB_EXT},$${$${TGT_PREREQS}_LDLIBS}) + + # + # OSX does lazy linking by default. We want to over-ride that for binaries. + # That way we catch errors at compile time, and not at run time. + # + ifneq "$(findstring apple-darwin,$(TARGET_SYSTEM))" "" + $${TGT}_LDFLAGS += -Wl,-undefined -Wl,error + endif + endif $${TGT}_BUILD := $$(if $$(suffix $${TGT}),$${BUILD_DIR}/lib,$${BUILD_DIR}/bin) $${TGT}_MAKEFILES += ${1} diff --git a/src/lib/util/libfreeradius-util.mk b/src/lib/util/libfreeradius-util.mk index 1289d7747ba..6a30967a3c2 100644 --- a/src/lib/util/libfreeradius-util.mk +++ b/src/lib/util/libfreeradius-util.mk @@ -3,7 +3,12 @@ # # Version: $Id$ # + +ifeq "$(TARGET_IS_WASM)" "yes" +TARGET := libfreeradius-util.js +else TARGET := libfreeradius-util$(L) +endif SOURCES := \ atexit.c \