Gordon Schumacher wrote:
> Indeed, I'm not even attempting to address that yet - for the 
> immediate moment, just getting each package's files isolated into its 
> own tarball is such a big first step that I'm willing to deal with any 
> changes that need to be made to install those packages.

Yeah, it's a little bit of work, but not all that bad.  In my 'vision' 
of the perfect balance between packaging and being PM neutral, I've 
chosen to create a /packages directory and use it as the working 
directory for packaging and installation.  I've divided each package 
into 3 parts: build, install, post-install, and used scripts for each.  
It's a first attempt so be nice!  It *can* be streamlined, (and cleaned 
of garbage like 'make DESTDIR=$DESTDIR install') but I also wanted to 
allow for maintaining a list of installed files and used/installed 
directories.  For example, here is my chapter 6 glibc and chapter 6 
binutils build scripts:

=====================================================
GLibC:

[...@name25 usb]# cat packages/glibc-2.8-20080929-1/build.sh
#!/bin/sh
# Begin build.sh

rm -rf package filelist.txt dirlist.txt glibc-2.8-20080929 glibc-build
mkdir -v package
DESTDIR=$PWD/package
tar -xf /sources/glibc-2.8-20080929.tar.bz2
cd glibc-2.8-20080929
sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED
patch -Np1 -i /sources/glibc-2.8-20080929-iconv_tests-1.patch
patch -Np1 -i /sources/glibc-2.8-20080929-ildoubl_test-1.patch
sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
mkdir -v ../glibc-build
cd ../glibc-build
echo "CFLAGS += -march=i486 -mtune=native" > configparms
../glibc-2.8-20080929/configure --prefix=/usr \
    --disable-profile --enable-add-ons \
    --enable-kernel=2.6.0 --libexecdir=/usr/lib/glibc
make
cp -v ../glibc-2.8-20080929/iconvdata/gconv-modules iconvdata
make -k check 2>&1 | tee glibc-check-log
grep Error glibc-check-log
touch /etc/ld.so.conf
make install_root=$DESTDIR install
mkdir -pv $DESTDIR/usr/lib/locale
make install_root=$DESTDIR localedata/install-locales
cd ..
rm -rf glibc-2.8-20080929
rm -rf glibc-build

# Remove generated files
rm -f $DESTDIR/usr/share/info/dir
rm -f $DESTDIR/etc/ld.so.cache

# Generate file and directly lists
cd package
for dir in `find . -type d`
do
    ls -ld $dir | sed "s@ ./@ /@";
done > ../dirlist.txt
for file in `find . -type f`
do
    ls -l $file | sed "s@ ./@ /@";
done > ../filelist.txt
cd ..

# End build.sh

[...@name25 usb]# cat packages/glibc-2.8-20080929-1/install.sh
#!/bin/sh
# Begin install.sh

# Install files
cp -av package/* /

# Set ownership
for dir in `cut -d " " -f 9 dirlist.txt`
do
    chown -v root:root $dir
done
for file in `cut -d " " -f 9 filelist.txt`
do
    chown -v root:root $file
done

# End install.sh

[...@name25 usb]# cat packages/glibc-2.8-20080929-1/post-install.sh
#! /bin/sh
# Begin post-install.sh

# Populate /etc/ld.so.conf (only if it is an empty file)
if [ -z "$(cat /etc/ld.so.conf)" ]
then
echo "Creating /etc/ld.so.conf."
cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf

/usr/local/lib
/opt/lib

# End /etc/ld.so.conf
EOF
fi

# Create /etc/nsswitch.conf if it does not exist
if [ ! -f /etc/nsswitch.conf ]
then
echo "Creating /etc/nsswitch.conf."
cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

hosts: files dns
networks: files

protocols: files
services: files
ethers: files
rpc: files

# End /etc/nsswitch.conf
EOF
fi

# Copy the /etc/localtime file (do not trust current TZ)
if [ -z "$TZD" ]
then
    TZD=`tzselect`
fi
cp -v --remove-destination /usr/share/zoneinfo/$TZD /etc/localtime

# Update /usr/share/info/dir
for info in `ls package/usr/share/info`
do
    echo "Installing /usr/share/info/$info."
    install-info --dir-file=/usr/share/info/dir \
        --info-file=/usr/share/info/$info
done

# Update the linker cache
/sbin/ldconfig

# End post-install.sh

[...@name25 usb]# cat packages/binutils-2.18-1/build.sh
#!/bin/sh
# Begin build.sh

rm -rf package filelist.txt dirlist.txt binutils-2.18 binutils-build
mkdir -v package
export DESTDIR="${PWD}/package"
tar -xf /sources/binutils-2.18.tar.bz2
cd binutils-2.18
expect -c "spawn ls"
patch -Np1 -i /sources/binutils-2.18-configure-1.patch
patch -Np1 -i /sources/binutils-2.18-GCC43-1.patch
rm -fv etc/standards.info
sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in
mkdir -v ../binutils-build
cd ../binutils-build
../binutils-2.18/configure --prefix=/usr \
    --enable-shared \
    --mandir=/usr/share/man \
    --infodir=/usr/share/info
make tooldir=/usr
make check
make tooldir=/usr DESTDIR=$DESTDIR install
cp -a ../binutils-2.18/include/libiberty.h ../package/usr/include
cd ..
rm -rf binutils-2.18
rm -rf binutils-build

# Remove generated and extraneous files
rm -f $DESTDIR/usr/share/info/dir
rm -f $DESTDIR/etc/ld.so.cache
rm -f $DESTDIR/usr/share/info/configure.info

# Generate file and directly lists
cd package
for dir in `find . -type d`
do
    ls -ld $dir | sed "s@ ./@ /@";
done > ../dirlist.txt
for file in `find . -type f`
do
    ls -l $file | sed "s@ ./@ /@";
done > ../filelist.txt
cd ..

# End build.sh

[...@name25 usb]# cat packages/binutils-2.18-1/install.sh
#!/bin/sh
# Begin install.sh

# Install files
cp -av package/* /

# Set ownership
for dir in `cut -d " " -f 9 dirlist.txt`
do
    chown -v root:root $dir
done
for file in `cut -d " " -f 9 filelist.txt`
do
    chown -v root:root $file
done

# End install.sh

[...@name25 usb]# cat packages/binutils-2.18-1/post-install.sh
#! /bin/sh
# Begin post-install.sh

# Update /usr/share/info/dir
for info in `ls package/usr/share/info`
do
    echo "Installing /usr/share/info/$info."
    install-info --dir-file=/usr/share/info/dir \
        --info-file=/usr/share/info/$info
done

# Update the linker cache
/sbin/ldconfig

# End post-install.sh

[...@name25 usb]#
====================================================

As you can see, there really isn't that much added to the existing 
instructions.  I was simply being tedious for the scripts.  I'd really 
like for LFS to go all the way to an unprivileged user to build the 
package.  From an educational standpoint, it is perfect as this is how 
the distro's do it (granted not in an extremely minimal chroot 
environment), however, I'm not so sure that this is an easily obtainable 
goal...hence why the whole thing is done as root for now (as is current 
LFS practice in the chroot environment).

-- DJ Lucas


-- 
This message has been scanned for viruses and
dangerous content, and is believed to be clean.

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to