-Fixed bug when moving "mv" command from /usr/bin to /bin
[hvlinux.git] / stage2 / cis-zlib
index a858ffc..74f9d9c 100755 (executable)
@@ -1,45 +1,35 @@
 #!/bin/sh
-# First argument of this script is the package name
+set -o errexit
+
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
 
 # Reading system configuration informations, functions and package versions.
 source ../sysinfos
 source ../functions
 source ../packages-list
 
-ZLIB_VERSION=$(get_pkg_ver ${1})
-
-# Zlib is known to build its shared library incorrectly if CFLAGS is
-# specified in the environment. We need to add the -fPIC directive to CFLAGS
-# for the duration of the below configure command, then remove it afterwards. 
-export CFLAGS="${CFLAGS} -fPIC"
+PACKAGE=${1}
+shift
+CONFIGURE_OPTS=${*}
 
 # Applying patches (if any)
-apply_patches ${1} &&
+apply_patches ${PACKAGE}
 
-cd ${LFS_TMP}/${1} &&
+cd ${LFS_TMP}/${PACKAGE}
 ./configure \
     --prefix=/usr \
-    --shared \
-    --libdir=/lib &&
-make -j ${MAKEJOBS} &&
-
-# Installing the shared library
-make install &&
+    ${CONFIGURE_OPTS}
+make
+make install
+ldconfig
 
-# The previous command installed a .so file in /lib. We will remove
-# it and relink it into /usr/lib:
-rm -v /lib/libz.so &&
-ln -sfv ../../lib/libz.so.${ZLIB_VERSION} /usr/lib/libz.so &&
-
-# Now also build the non-shared (static) library: 
-make clean &&
-./configure \
-    --prefix=/usr &&
-make -j ${MAKEJOBS} &&
-make install &&
+# The previous command installed two .so files into /usr/lib.
+# We will move it into /lib and then relink it to /usr/lib:
+mv -v /usr/lib/libz.so.* /lib
+ln -svf ../../lib/libz.so.1 /usr/lib/libz.so
 
 # Fix the permissions on the static library: 
 chmod 644 /usr/lib/libz.a
 
-# Return last error
 exit $?