From e627a1e94bb526a2611e6a937c80b62874e990b0 Mon Sep 17 00:00:00 2001 From: xambroz <723625+xambroz@users.noreply.github.com> Date: Sat, 3 Apr 2021 23:50:38 +0200 Subject: [PATCH 1/3] Remove harmful rpath in LDFLAGS and fix logic for cargo. This patch is from Debian libemu package - libemu-03_remove_rpath_and_fix_ldflags.patch https://packages.debian.org/search?searchon=sourcenames&keywords=libemu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: Remove harmful rpath in LDFLAGS and fix logic for cargo. Before this patch, libemu was searching for includes and also had an rpath for libraries in /usr/local/lib. Also the logic for libcargo is wrong, as makes the content of LDFLAGS empty if cargo is enabled but there are no headers in the system. This was preventing proper hardening to be activated in Debian. Author: David Martínez Moreno ender@debian.org Forwarded: no Reviewed-By: David Martínez Moreno ender@debian.org Last-Update: 2012-10-14 --- configure.ac | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8771c14..34d2611 100644 --- a/configure.ac +++ b/configure.ac @@ -25,8 +25,9 @@ case "$host" in pkgconfigdir="/usr/lib/pkgconfig" ;; *-*-linux*) - CPPFLAGS="$CPPFLAGS -D _GNU_SOURCE -I/usr/local/include -Wno-unused-local-typedefs" - LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-rpath,/usr/local/lib" + # CPPFLAGS="$CPPFLAGS -D _GNU_SOURCE -I/usr/local/include -Wno-unused-local-typedefs" + CPPFLAGS="$CPPFLAGS -D _GNU_SOURCE -Wno-unused-local-typedefs" + # LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-rpath,/usr/local/lib" pkgconfigdir="/usr/lib/pkgconfig" ;; *-*-darwin*) @@ -175,6 +176,7 @@ AC_ARG_WITH(cargos-lib, if test x$enable_cargos = "xyes" ; then OLD_CPPFLAGS=${CPPFLAGS}; + OLD_LDFLAGS=${LDFLAGS} if test x$cargos_inc != "xno"; then CPPFLAGS="${CPPFLAGS} -I${cargos_inc}" fi @@ -182,7 +184,6 @@ if test x$enable_cargos = "xyes" ; then AC_CHECK_HEADER(cargos-lib.h,[enable_cargos=yes],[enable_cargos=no]) if test x$enable_cargos = "xyes" ; then - OLD_LDFLAGS=${LDFLAGS} if test x$cargos_lib != "xno"; then LDFLAGS="${LDFLAGS} -L${cargos_lib}" fi From b95405569a3a86113bb06db30b5df2d433d400ff Mon Sep 17 00:00:00 2001 From: xambroz <723625+xambroz@users.noreply.github.com> Date: Sun, 4 Apr 2021 01:15:30 +0200 Subject: [PATCH 2/3] align PKGCONFIGDIR case with other variables CPPFLAGS --- configure.ac | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 34d2611..fbd0c49 100644 --- a/configure.ac +++ b/configure.ac @@ -22,25 +22,25 @@ case "$host" in *-*-freebsd*) CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/usr/src/contrib/file/ -Wno-unused-local-typedefs" LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-rpath,/usr/local/lib" - pkgconfigdir="/usr/lib/pkgconfig" + PKGCONFIGDIR="/usr/lib/pkgconfig" ;; *-*-linux*) # CPPFLAGS="$CPPFLAGS -D _GNU_SOURCE -I/usr/local/include -Wno-unused-local-typedefs" CPPFLAGS="$CPPFLAGS -D _GNU_SOURCE -Wno-unused-local-typedefs" # LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-rpath,/usr/local/lib" - pkgconfigdir="/usr/lib/pkgconfig" + PKGCONFIGDIR="/usr/lib/pkgconfig" ;; *-*-darwin*) CPPFLAGS="$CPPFLAGS -I/opt/local/include -Wno-unused-local-typedefs" LDFLAGS="$LDFLAGS -L/opt/local/lib" - pkgconfigdir="/usr/local/lib/pkgconfig" + PKGCONFIGDIR="/usr/local/lib/pkgconfig" if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wno-unused-local-typedefs -Wno-tautological-compare" fi ;; esac -AC_SUBST([pkgconfigdir]) +AC_SUBST([PKGCONFIGDIR]) # Checks for programs. AC_PROG_CC From f80c649607091f6cde05f0a4f1f654fca847a90e Mon Sep 17 00:00:00 2001 From: xambroz <723625+xambroz@users.noreply.github.com> Date: Sun, 4 Apr 2021 01:16:34 +0200 Subject: [PATCH 3/3] align PKGCONFIGDIR case with other variables CPPFLAGS --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index e02628b..1abea77 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,6 @@ SUBDIRS = src include testsuite doc bindings tools EXTRA_DIST = configure.ac CHANGES libemu.pc.in -pkgconfigdir = @pkgconfigdir@ +pkgconfigdir = @PKGCONFIGDIR@ pkgconfig_DATA = libemu.pc