From ea2dfe7386ae02dac0cb7a54f4cb6cea0213585f Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Wed, 27 May 2009 06:33:49 +0000 Subject: [PATCH] Revert zlib to doing separate builds for static and dynamic libraries to ensure the -fPIC parameter is set properly in both cases. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8932 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter01/changelog.xml | 6 ++++++ chapter01/whatsnew.xml | 3 ++- chapter06/zlib.xml | 39 ++++++++++++++++++++++++++++----------- general.ent | 4 ++-- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 30c4d07c4..c588aee79 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -40,6 +40,12 @@ 2009-05-27 + + [bdubbs] - Revert zlib to doing separate builds for + static and dynamic libraries to ensure the -fPIC parameter + is set properly in both cases. + Fixes #2329 (again). + [bdubbs] - Update gettext patch to -2 for an additional bug fix. Thanks to Robert Connolly for the patch. diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index 7cc557eeb..d68cfb869 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -307,10 +307,11 @@ vim-7.2-fixes-3.patch + diff --git a/chapter06/zlib.xml b/chapter06/zlib.xml index 9d4fccd81..c3c00730c 100644 --- a/chapter06/zlib.xml +++ b/chapter06/zlib.xml @@ -47,17 +47,12 @@ a specified CFLAGS variable, be sure to add the -fPIC directive to the CFLAGS variable for the duration of the configure command below, then - remove it afterwards. + remove it when building the static library. - Modify the build scripts to ensure compilation with position independent - code and allow building both static and dynamic libraries in one step: + Prepare Zlib for building the dynamic library: -patch -Np1 -i ../&zlib-fpic-patch; - - Prepare Zlib for compilation: - -./configure --prefix=/usr --shared +./configure --prefix=/usr --shared --libdir=/lib Compile the package: @@ -67,13 +62,35 @@ make check - Install the libraries: + Install the shared library: make install - Finally, fix permissions on the static library: + The previous command installed a .so file in /lib. We will remove it and relink it into + /usr/lib: -chmod 0644 /usr/lib/libz.a +rm -v /lib/libz.so +ln -sfv ../../lib/libz.so.&zlib-version; /usr/lib/libz.so + + Build the static library: + +make clean +./configure --prefix=/usr +make + + To test the results again, issue: + +make check + + Install the static library: + +make install + + Fix the permissions on the static library: + +chmod -v 644 /usr/lib/libz.a diff --git a/general.ent b/general.ent index c9540f27f..4e7fd0925 100644 --- a/general.ent +++ b/general.ent @@ -1,6 +1,6 @@ - - + +