]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix building libfreeradius-util under emscripten
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 28 Jun 2022 15:08:12 +0000 (10:08 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 28 Jun 2022 15:08:18 +0000 (10:08 -0500)
scripts/boiler.mk
src/lib/util/libfreeradius-util.mk

index e7f71887d418d35dff1fdf0f24f22d9cb9bb224f..64cfd474cef7f50f108e2afc5d5b16f7e62e5210 100644 (file)
@@ -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}
index 1289d7747ba4438f945ebd2122661d13a0067182..6a30967a3c2ae69e9d21099b3103035eac3821b6 100644 (file)
@@ -3,7 +3,12 @@
 #
 # Version:      $Id$
 #
+
+ifeq "$(TARGET_IS_WASM)" "yes"
+TARGET         := libfreeradius-util.js
+else
 TARGET         := libfreeradius-util$(L)
+endif
 
 SOURCES                := \
                   atexit.c \