-#!/bin/sh
+#!/bin/bash
+set -o errexit
+
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+PACKAGE=${1}
+shift
+CONFIGURE_OPTS=${*}
# Reading system configuration informations, functions and package versions.
source ../sysinfos
source ../packages-list
# Applying patches (if any)
-apply_patches ${1} &&
+apply_patches ${PACKAGE}
+
+cd ${LFS_TMP}/${PACKAGE}/gettext-tools
+
+# When cross-compiling the Gettext configure script assumes we don't have a
+# working wcwidth when we do. The following will fix possible compilation
+# errors because of this assumption:
+echo "gl_cv_func_wcwidth_works=yes" > config.cache
-cd ${LFS_TMP}/${1}/gettext-tools &&
-./configure \
+CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
+ ./configure \
--prefix=/tools \
- --disable-shared &&
-make -j ${MAKEJOBS} -C gnulib-lib &&
-make -j ${MAKEJOBS} -C src msgfmt &&
+ --build=${CLFS_HOST} \
+ --host=${CLFS_TARGET} \
+ --disable-shared \
+ --cache-file=config.cache
+${HVMAKE} -C gnulib-lib
+${HVMAKE} -C src msgfmt
cp -v src/msgfmt /tools/bin
-# Return last error
exit $?