From f6c70f9f192d058f1f43921f570815146751cfac Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Thu, 8 Sep 2016 17:11:51 +0000
Subject: [PATCH] travis: add x86 musl

* .travis.yml (matric): Add musl-gcc/x86.
* travis-build.sh [TARGET == x86]: Specify --target along with --build
to configure.
* travis-install.sh [CC == musl-gcc && TARGET == x32]: Add -mx32 to $CC.
[CC == musl-gcc && TARGET == x86]: Add -m32 to $CC.  Specify --build
and --target to musl configure invocation.
---
 .travis.yml       |  3 +++
 travis-build.sh   |  2 +-
 travis-install.sh | 12 +++++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index d3307a02..0eba591d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -39,3 +39,6 @@ matrix:
     - compiler: clang-3.6
       env:
         - TARGET=x86
+    - compiler: musl-gcc
+      env:
+        - TARGET=x86
diff --git a/travis-build.sh b/travis-build.sh
index e6da4bb1..32ccd508 100755
--- a/travis-build.sh
+++ b/travis-build.sh
@@ -17,7 +17,7 @@ case "${TARGET-}" in
 		;;
 	x86)
 		CC="$CC -m32"
-		export DISTCHECK_CONFIGURE_FLAGS='--build=i686-pc-linux-gnu'
+		export DISTCHECK_CONFIGURE_FLAGS='--build=i686-pc-linux-gnu --target=i686-pc-linux-gnu'
 		;;
 esac
 
diff --git a/travis-install.sh b/travis-install.sh
index a34e5d0e..ba5ff2df 100755
--- a/travis-install.sh
+++ b/travis-install.sh
@@ -23,7 +23,17 @@ case "$CC" in
 		git clone --depth=1 https://github.com/strace/musl
 		cd musl
 			CC=gcc
-			./configure --prefix=/opt/musl --exec-prefix=/usr
+			build=
+			case "${TARGET-}" in
+				x32)
+					CC="$CC -mx32"
+					;;
+				x86)
+					CC="$CC -m32"
+					build='--build=i686-pc-linux-gnu --target=i686-pc-linux-gnu'
+					;;
+			esac
+			./configure --prefix=/opt/musl --exec-prefix=/usr ${build}
 			make
 			sudo make install
 		cd -
-- 
2.40.0