From d12245ac5f70e02620b30c1f3dd78c430d51dd59 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Mon, 21 Sep 2020 16:24:24 +0200
Subject: [PATCH] MISC: Build dependencies with the specified compiler for
 lektor

---
 configure            | 5 +++--
 configure.ac         | 5 +++--
 depends/rules.txt    | 2 +-
 scripts/depends.bash | 4 ++--
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index f3bbe3e1..fe480525 100755
--- a/configure
+++ b/configure
@@ -13633,7 +13633,7 @@ if test "x${LKT_DEBUG_ENABLED}" = "xyes" ; then
 else
     BASEFLAGS="${BASEFLAGS} -O3"
 fi
-CFLAGS="${BASEFLAGS} -std=c11"
+CFLAGS="${CFLAGS} ${BASEFLAGS} -std=c11"
 
 #################################
 # BUILD WITH THE DEPENDS SCRIPT #
@@ -13685,7 +13685,8 @@ fi
 
 
 
-    CFLAGS="${CFLAGS} -I$PWD/depends_install/include -L$PWD/depends_install/lib"
+    CFLAGS="${CFLAGS} -I$PWD/depends_install/include"
+    LDFLAGS="${LDFLAGS} -L$PWD/depends_install/lib"
 
     # Download and build dependencies
     cd $LKT_PATH_SOURCE
diff --git a/configure.ac b/configure.ac
index d9accc89..be43146c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -130,7 +130,7 @@ if test "x${LKT_DEBUG_ENABLED}" = "xyes" ; then
 else
     BASEFLAGS="${BASEFLAGS} -O3"
 fi
-CFLAGS="${BASEFLAGS} -std=c11"
+CFLAGS="${CFLAGS} ${BASEFLAGS} -std=c11"
 
 #################################
 # BUILD WITH THE DEPENDS SCRIPT #
@@ -145,7 +145,8 @@ AM_CONDITIONAL([LKT_DEPENDS_ENABLE], [test "x${LKT_BUILD_DEPENDS}" = "xyes"])
 if test "x$LKT_BUILD_DEPENDS" = "xyes" ; then
     LKT_LIB_DIR="$PWD/depends_install/lib"
     AC_DISABLE_SHARED
-    CFLAGS="${CFLAGS} -I$PWD/depends_install/include -L$PWD/depends_install/lib"
+    CFLAGS="${CFLAGS} -I$PWD/depends_install/include"
+    LDFLAGS="${LDFLAGS} -L$PWD/depends_install/lib"
 
     # Download and build dependencies
     cd $LKT_PATH_SOURCE
diff --git a/depends/rules.txt b/depends/rules.txt
index 19275750..b5be0f65 100644
--- a/depends/rules.txt
+++ b/depends/rules.txt
@@ -2,5 +2,5 @@ zlib        zconfigure  	--static --64
 iconv       configure   	--disable-shared
 openssl		sslconfigure	no-shared -fPIC no-hw
 sqlite3     configure   	--disable-shared --disable-tcl CFLAGS=-fPIC --enable-update-limit
-sdl2        configure   	--disable-shared --enable-fcitx --enable-input-tslib=no CFLAGS=-fPIC --enable-joystick=no
+sdl2        configure   	--disable-shared --enable-fcitx --enable-input-tslib=no CFLAGS=-fPIC
 libcurl     configure   	--disable-shared --without-zlib --enable-optimize --disable-rt --disable-pop3 --disable-imap --disable-rtsp --disable-smtp --disable-smb --disable-smbs --disable-dict --disable-tftp --enable-https --enable-http --enable-mime --disable-threaded-resolver --without-zsh-functions-dir --without-fish-functions-dir --with-ssl=__BUILD_DIR__ --with-zlib=__BUILD_DIR__
diff --git a/scripts/depends.bash b/scripts/depends.bash
index 237550d8..28edb7b1 100755
--- a/scripts/depends.bash
+++ b/scripts/depends.bash
@@ -155,13 +155,13 @@ do
         zconfigure)
             # The CC= and CXX= doesn't work for zlib
             # TODO pour le Kubat du futur: trouver un moyen uniforme de passer le '-fPIC'
-            CFLAGS="-fPIC" $ROOT_DIR/depends/$FOLD/configure --prefix=$ABS_BUILD_DIR/depends_install $OPT
+            CC=$CC CXX=$CXX CFLAGS="-fPIC" $ROOT_DIR/depends/$FOLD/configure --prefix=$ABS_BUILD_DIR/depends_install $OPT
             [ $? -ne 0 ] && die "Failed to configure $FOLD"
             ;;
         sslconfigure)
             # Yes, we need to call Configure and not configure here...
             # TODO pour le Kubat du futur: trouver un moyen de pas ardcoder le linux-x86_64 (build FreeBSD, OSX et autres)
-            $ROOT_DIR/depends/$FOLD/Configure --prefix=$ABS_BUILD_DIR/depends_install $OPT linux-x86_64
+            CC=$CC CXX=$CXX $ROOT_DIR/depends/$FOLD/Configure --prefix=$ABS_BUILD_DIR/depends_install $OPT linux-x86_64
             [ $? -ne 0 ] && die "Failed to configure $FOLD"
             ;;
     esac
-- 
GitLab