On Thu, Feb 11, 2021 at 6:27 PM Julian Andres Klode <[email protected]> wrote:
>
> In Ubuntu, the attached patch was applied to achieve the following:
>
> * Make build test cross-testable
In the debdiff:
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CC="$DEB_HOST_GNU_TYPE-g++"
+ PKGCONFIG="$DEB_HOST_GNU_TYPE-pkg-config"
+else
+ CC=gcc
+ PKGCONFIG=pkg-config
+fi
Thanks for proposing this, but how come g++ becomes the compiler
instead of gcc when cross-compiling?
While simply replacing "-g++" with "-gcc" in the patch could fix it,
I'd rather adapt another patch proposed for libthai in bug #983522
which ensures the compiler does not get changed by accident:
diff --git a/debian/tests/build b/debian/tests/build
index 92163dc..98d8985 100755
--- a/debian/tests/build
+++ b/debian/tests/build
@@ -7,6 +7,13 @@ set -e
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+ CROSS_COMPILE=
+fi
+
cat <<EOF > libdatrietest.c
#include <datrie/trie.h>
#include <assert.h>
@@ -27,7 +34,8 @@ int main (int argc, char *argv[])
}
EOF
-gcc -o libdatrietest libdatrietest.c $(pkg-config --cflags --libs datrie-0.2)
+${CROSS_COMPILE}gcc -o libdatrietest libdatrietest.c \
+ $(${CROSS_COMPILE}pkg-config --cflags --libs datrie-0.2)
echo "build: OK"
[ -x libdatrietest ]
./libdatrietest
Thanks again for the sync.
Regards,
--
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/