# configuration file of the 'build-tmpsys' step

###############################################################################
# Part 1: mirrors

# -----------------------------------------------------------------------------
# GNU mirrors
mirror.gnu.1 = ftp://prep.ai.mit.edu/pub/gnu
# just for testing falling back mirrors
#mirror.gnu.1 = ftp://toto.marche.pas
mirror.gnu.2 = ftp://ftp.gnu.org/pub/gnu

# -----------------------------------------------------------------------------
# Kernel mirrors (not only for the kernel, but also all related tools)
mirror.kernel.1 = ftp://ftp.free.fr/mirrors/ftp.kernel.org/linux
mirror.kernel.2 = ftp://ftp.fr.kernel.org/pub/linux

# -----------------------------------------------------------------------------
# Sourceforge mirrors
mirror.sourceforge.1 = http://ovh.dl.sourceforge.net/sourceforge

# -----------------------------------------------------------------------------
# Linux From Scratch mirrors (mainly for patches)
mirror.lfs.1 = http://lfs.icx.fr/patches/lfs/development


###############################################################################
# Part 2: packages organization

# -----------------------------------------------------------------------------
# in which order the packages will be built. Note that the package name isn't
# artificial, it determines the property name for each package, for example
# package.binutils-pass1.*

packages.order = {{{
binutils-pass1
gcc-pass1
linux-libc-headers
glibc
adjust-toolchain
gcc-pass2
binutils-pass2
ncurses
bash
bzip2
coreutils
diffutils
findutils
gawk
gettext
grep
gzip
m4
make
patch
perl
sed
tar
texinfo
util-linux
bison
flex
file
wget
libxml2
libxslt
zlib
xmlstarlet
p7zip
nano
stripping
}}} packages.order



###############################################################################
# Part 3: packages definitions
#
# For each package, you can define some parameters, but all are optional.
# I choose to define them in alphabetic order, as it's more convenient to find
# them, and we already have the order above.
#
# Any previously defined parameter in one package can be use for other
# definitions of this package, by using @<parameter name>@. For example,
# @version@ correspond to the value of package.<name>.version
#
# * package.<name>.version is the version of the package (yes, really :-)
# * package.<name>.srctree is the unpacked source tree. If not defined, will
#   default to the package name plus the version: <name>-<version>, or just
#   <name> if version isn't defined
# * package.<name>.archive.? is an archive file to download. If Ngadkm already
#   has this archive, it wont download it a second time. You can add as many
#   archive as you want, incrementing the value after 'archive.', until there's
#   no hops (for exemple, do not define archive.1 and then archive.3). A miss
#   will result in a search stop in archive definitions.
# * package.<name>.patch.? has the same behaviour than the archive files, but
#   for patches :-)
# * package.<name>.commands is the list of commands to execute when package
#   is proceded. All @var@ variables are available as standard shell variables
#   with pkg_ prefixed. For example: @version@ gives $pkg_version
#   The original @var@ form isn't use because it may cause problems with some
#   commands.
#
# Special values are preassigned: @mirror.<type>@ correspond to the mirror
# lists defined in ngadkm.conf as mirror.<type>.1, mirror.<type>.2, etc..
# Ngadkm will resolve the first one, and if it fails, the second one, etc..

# -----------------------------------------------------------------------------
# adjust-toolchain
package.adjust-toolchain.commands = {{{

# new LFS way to adjust the toolchain
# (no need to mark anymore ?)
dump_machine=`/tmpsys/bin/gcc -dumpmachine`
dkm_launch mv -v /tmpsys/bin/ld /tmpsys/bin/ld-old
dkm_launch mv -v /tmpsys/$dump_machine/bin/ld /tmpsys/$dump_machine/bin/ld-old
dkm_launch mv -v /tmpsys/bin/{ld-new,ld}
dkm_launch ln -sv /tmpsys/bin/ld /tmpsys/$dump_machine/bin/ld

# the old way
dkm_mark binutils-pass1
#dkm_launch make -C ld install

SPECFILE=`dirname $(/tmpsys/bin/gcc -print-libgcc-file-name)`/specs
dkm_launch /tmpsys/bin/gcc -dumpspecs > $SPECFILE
dkm_sed $SPECFILE 's@^/lib/ld-linux.so.2@/tmpsys&@g'
unset SPECFILE

GCC_INCLUDEDIR=`dirname $(/tmpsys/bin/gcc -print-libgcc-file-name)`/include
dkm_launch find ${GCC_INCLUDEDIR}/* -maxdepth 0 -xtype d -exec rm -rvf '{}' \;
dkm_launch rm -f `grep -l "DO NOT EDIT THIS FILE" ${GCC_INCLUDEDIR}/*`
unset GCC_INCLUDEDIR

echo 'main(){}' > dummy.c
dkm_launch cc dummy.c
dkm_launch readelf -l a.out | grep ": /tmpsys/lib/"
dkm_launch rm -v dummy.c a.out

dkm_del dir $mark_srctree
dkm_del dir $mark_buildtree
}}} package.adjust-toolchain.commands

# -----------------------------------------------------------------------------
# bash
package.bash.version = 3.1
package.bash.archive.1 = @mirror.gnu@/bash/@srctree@.tar.gz
package.bash.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys \
	--without-bash-malloc
dkm_launch make
dkm_launch make install
dkm_launch ln -sv bash /tmpsys/bin/sh
dkm_del sources
}}} package.bash.commands

# -----------------------------------------------------------------------------
# binutils-pass1
package.binutils-pass1.version = 2.16.1
package.binutils-pass1.srctree = binutils-@version@
package.binutils-pass1.archive.1 = @mirror.gnu@/binutils/@srctree@.tar.bz2
package.binutils-pass1.commands = {{{
dkm_unpack
dkm_mkbuildtree

dkm_launch ../$pkg_srctree/configure \
	--prefix=/tmpsys \
	--disable-nls
dkm_launch make
dkm_launch make install
dkm_launch make -C ld clean
dkm_launch make -C ld LIB_PATH=/tmpsys/lib
dkm_launch cp -v ld/ld-new /tmpsys/bin

# still needed ?
dkm_mark
}}} package.binutils-pass1.commands

# -----------------------------------------------------------------------------
# binutils-pass2
package.binutils-pass2.version = 2.16.1
package.binutils-pass2.srctree = binutils-@version@
package.binutils-pass2.archive.1 = @mirror.gnu@/binutils/@srctree@.tar.bz2
package.binutils-pass2.commands = {{{
dkm_unpack
dkm_mkbuildtree

dkm_launch ../binutils-$VERSION/configure \
	--prefix=/tmpsys \
	--disable-nls \
	--with-lib-path=/tmpsys/lib
dkm_launch make
dkm_launch make install
dkm_launch make -C ld clean
dkm_launch make -C ld LIB_PATH=/usr/lib:/lib
dkm_launch cp -v ld/ld-new /tmpsys/bin

# still needed ?
dkm_mark
}}} package.binutils-pass2.commands

# -----------------------------------------------------------------------------
# bison
package.bison.version = 2.3
package.bison.archive.1 = @mirror.gnu@/bison/@srctree@.tar.bz2
package.bison.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.bison.commands

# -----------------------------------------------------------------------------
# bzip2
package.bzip2.version = 1.0.3
package.bzip2.archive.1 = http://www.bzip.org/@version@/@srctree@.tar.gz
package.bzip2.commands = {{{
dkm_unpack
dkm_launch make
dkm_launch make PREFIX=/tmpsys install
dkm_del sources
}}} package.bzip2.commands

# -----------------------------------------------------------------------------
# coreutils
package.coreutils.version = 5.96
package.coreutils.archive.1 = @mirror.gnu@/coreutils/@srctree@.tar.bz2
package.coreutils.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.coreutils.commands

# -----------------------------------------------------------------------------
# diffutils
package.diffutils.version = 2.8.1
package.diffutils.archive.1 = @mirror.gnu@/diffutils/@srctree@.tar.gz
package.diffutils.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.diffutils.commands

# -----------------------------------------------------------------------------
# file
package.file.version = 4.17
package.file.archive.1 = ftp://ftp.astron.com/pub/file/@srctree@.tar.gz
package.file.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.file.commands

# -----------------------------------------------------------------------------
# findutils
package.findutils.version = 4.2.27
package.findutils.archive.1 = @mirror.gnu@/findutils/@srctree@.tar.gz
package.findutils.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.findutils.commands

# -----------------------------------------------------------------------------
# flex
package.flex.version = 2.5.33
package.flex.archive.1 = @mirror.sourceforge@/lex/@srctree@.tar.bz2
package.flex.patch.1 = @mirror.lfs@/@srctree@-debian_fixes-3.patch
package.flex.commands = {{{
dkm_unpack
dkm_patch $pkg_srctree-debian_fixes-3.patch
dkm_launch touch doc/flex.1

dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_launch ln -s libfl.a /tmpsys/lib/libl.a

dkm_launch lcat > /tmpsys/bin/lex << "EOF"
#!/bin/sh
exec /usr/bin/flex -l "$@"
EOF
dkm_launch lchmod 755 /tmpsys/bin/lex

dkm_del sources
}}} package.flex.commands

# -----------------------------------------------------------------------------
# gawk
package.gawk.version = 3.1.5
package.gawk.archive.1 = @mirror.gnu@/gawk/@srctree@.tar.bz2
package.gawk.commands = {{{
dkm_unpack

dkm_launch ./configure \
	--prefix=/tmpsys

dkm_launch cat >> config.h << "EOF"
#define HAVE_LANGINFO_CODESET 1
#define HAVE_LC_MESSAGES 1
EOF

dkm_launch make
dkm_launch make install

dkm_del sources
}}} package.gawk.commands

# -----------------------------------------------------------------------------
# gcc-pass1
package.gcc-pass1.version = 4.0.3
package.gcc-pass1.srctree = gcc-@version@
package.gcc-pass1.archive.1 = @mirror.gnu@/gcc/@srctree@/gcc-core-@version@.tar.bz2
package.gcc-pass1.commands = {{{
dkm_unpack
dkm_mkbuildtree

dkm_launch ../$pkg_srctree/configure \
	--prefix=/tmpsys \
	--with-local-prefix=/tmpsys \
	--disable-nls \
	--enable-shared \
	--enable-languages=c
dkm_launch make bootstrap
dkm_launch make install
dkm_launch ln -vs gcc /tmpsys/bin/cc

dkm_del build
dkm_del sources
}}} package.gcc-pass1.commands

# -----------------------------------------------------------------------------
# gcc-pass2
package.gcc-pass2.version = 4.0.3
package.gcc-pass2.srctree = gcc-@version@
package.gcc-pass2.archive.1 = @mirror.gnu@/gcc/@srctree@/gcc-core-@version@.tar.bz2
package.gcc-pass2.archive.2 = @mirror.gnu@/gcc/@srctree@/gcc-g++-@version@.tar.bz2
package.gcc-pass2.patch.1 = @mirror.lfs@/@srctree@-specs-1.patch
package.gcc-pass2.commands = {{{
dkm_unpack
dkm_sed gcc/Makefile.in 's@\./fixinc\.sh@-c true@'
dkm_sed gcc/Makefile.in 's/^XCFLAGS =$/& -fomit-frame-pointer/'
dkm_patch $pkg_srctree-specs-1.patch
dkm_mkbuildtree

dkm_launch ../$pkg_srctree/configure \
	--prefix=/tmpsys \
	--with-local-prefix=/tmpsys \
	--enable-clocale-gnu \
	--enable-shared \
	--enable-threads=posix \
	--enable-__cxa_atexit \
	--enable-languages=c,c++ \
	--disable-libstdcxx-pch
dkm_launch make
dkm_launch make install

echo 'main(){}' > dummy.c
dkm_launch cc dummy.c
dkm_launch readelf -l a.out | grep ": /tmpsys/lib/"
dkm_launch rm -v dummy.c a.out

dkm_del del build
dkm_del del sources
}}} package.gcc-pass2.commands

# -----------------------------------------------------------------------------
# gettext
package.gettext.version = 0.14.5
package.gettext.archive.1 = @mirror.gnu@/gettext/@srctree@.tar.gz
package.gettext.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys \
	--disable-shared
dkm_launch make -C lib
dkm_launch make -C src msgfont
dkm_launch cp -v src/msgfont /tmpsys/bin
dkm_del sources
}}} package.gettext.commands

# -----------------------------------------------------------------------------
# glibc
package.glibc.version = 2.3.6
package.glibc.archive.1 = @mirror.gnu@/glibc/@srctree@.tar.bz2
package.glibc.commands = {{{
dkm_unpack
dkm_mkbuildtree

dkm_launch ../$pkg_srctree/configure \
	--prefix=/tmpsys \
	--disable-profile \
	--enable-add-ons \
	--enable-kernel=2.6.0 \
	--with-binutils=/tmpsys/bin \
	--without-gd \
	--with-headers=/tmpsys/include \
	--without-selinux
dkm_launch make
dkm_launch mkdir -v /tmpsys/etc
dkm_launch touch /tmpsys/etc/ld.so.conf
dkm_launch make install

dkm_del build
dkm_del sources
}}} package.glibc.commands

# -----------------------------------------------------------------------------
# grep
package.grep.version = 2.5.1a
package.grep.archive.1 = @mirror.gnu@/grep/@srctree@.tar.bz2
package.grep.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys \
	--disable-perl-regexp
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.grep.commands

# -----------------------------------------------------------------------------
# gzip
package.gzip.version = 1.3.5
package.gzip.archive.1 = @mirror.gnu@/gzip/@srctree@.tar.bz2
package.gzip.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.gzip.commands

# -----------------------------------------------------------------------------
# libxml2
package.libxml2.version = 2.6.26
package.libxml2.archive.1 = ftp://xmlsoft.org/libxml2/@srctree@.tar.gz
package.libxml2.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.libxml2.commands

# -----------------------------------------------------------------------------
# libxslt
package.libxslt.version = 1.1.17
package.libxslt.archive.1 = ftp://xmlsoft.org/libxml2/@srctree@.tar.gz
package.libxslt.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys \
	--with-crypto=no
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.libxslt.commands

# -----------------------------------------------------------------------------
# linux-libc-headers
package.linux-libc-headers.version = 2.6.12.0
package.linux-libc-headers.archive.1 = http://ep09.pld-linux.org/~mmazur/linux-libc-headers/@srctree@.tar.bz2
package.linux-libc-headers.commands = {{{
dkm_unpack

dkm_launch cp -Rv include/asm-i386 /tmpsys/include/asm
dkm_launch cp -Rv include/linux /tmpsys/include

dkm_del sources
}}} package.linux-libc-headers.commands

# -----------------------------------------------------------------------------
# m4
package.m4.version = 1.4.4
package.m4.archive.1 = @mirror.gnu@/m4/@srctree@.tar.bz2
package.m4.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.m4.commands

# -----------------------------------------------------------------------------
# make
package.make.version = 3.80
package.make.archive.1 = @mirror.gnu@/make/@srctree@.tar.bz2
package.make.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.make.commands

# -----------------------------------------------------------------------------
# nano
package.nano.version = 1.2.5
package.nano.archive.1 = http://www.nano-editor.org/dist/v1.2/@srctree@.tar.gz
package.nano.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.nano.commands

# -----------------------------------------------------------------------------
# ncurses
package.ncurses.version = 5.5
package.ncurses.archive.1 = @mirror.gnu@/ncurses/@srctree@.tar.gz
package.ncurses.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys \
	--with-shared \
	--without-debug \
	--without-ada \
	--enable-overwrite
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.ncurses.commands

# -----------------------------------------------------------------------------
# p7zip
# should try 4.42, but check if they didn't changed (hum
# created) the configure step :-)
package.p7zip.version = 4.30
package.p7zip.srctree = p7zip_@version@
package.p7zip.archive.1 = @mirror.sourceforge@/p7zip/@srctree@_src_all.tar.bz2
package.p7zip.commands = {{{
dkm_unpack
dkm_launch make
dkm_sed install.sh  "s@DEST_HOME=/usr/local@DEST_HOME=/tmpsys@g"
dkm_launch make DEST_BIN=/tmpsys/bin DEST_SHARE=/tmpsys/lib/p7zip DEST_MAN=/tmpsys/man install
dkm_del sources
}}} package.p7zip.commands

# -----------------------------------------------------------------------------
# patch
package.patch.version = 2.5.4
package.patch.archive.1 = @mirror.gnu@/patch/@srctree@.tar.gz
package.patch.commands = {{{
dkm_unpack
dkm_launch CPPFLAGS=-D_GNU_SOURCE ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.patch.commands

# -----------------------------------------------------------------------------
# perl
package.perl.version = 5.8.8
package.perl.archive.1 = http://www.perl.com/CPAN/src/@srctree@.tar.bz2
package.perl.patch.1 = @mirror.lfs@/@srctree@-libc-2.patch
package.perl.commands = {{{
dkm_unpack
dkm_patch $pkg_srctree-libc-1.patch

dkm_launch ./configure.gnu \
	--prefix=/tmpsys
	-Dstatic_ext='Data/Dumper Fcntl IO POSIX'
dkm_launch make perl utilities
dkm_launch cp -v perl pod/pod2man /tmpsys/bin
dkm_launch mkdir -pv /tmpsys/lib/perl5/$pkg_version
dkm_launch cp -Rv lib/* /tmpsys/lib/perl5/$pkg_version

dkm_del sources
}}} package.perl.commands

# -----------------------------------------------------------------------------
# sed
package.sed.version = 4.1.5
package.sed.archive.1 = @mirror.gnu@/sed/@srctree@.tar.gz
package.sed.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.sed.commands

# -----------------------------------------------------------------------------
# stripping
package.stripping.commands = {{{
dkm_launch strip --strip-debug /tmpsys/lib/*
dkm_launch strip --strip-unneeded /tmpsys/{,s}bin/*
dkm_launch rm -Rf /tmpsys/{info,man}
}}} package.stripping.commands

# -----------------------------------------------------------------------------
# tar
package.tar.version = 1.15.1
package.tar.archive.1 = @mirror.gnu@/tar/@srctree@.tar.bz2
package.tar.patch.1 = @mirror.lfs@/@srctree@-gcc4_fix_tests-1.patch
package.tar.commands = {{{
dkm_unpack
dkm_patch $pkg_srctree-gcc4_fix_tests-1.patch
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.tar.commands

# -----------------------------------------------------------------------------
# texinfo
package.texinfo.version = 4.8
package.texinfo.archive.1 = @mirror.gnu@/texinfo/@srctree@.tar.bz2
package.texinfo.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.texinfo.commands

# -----------------------------------------------------------------------------
# util-linux
package.util-linux.version = 2.12r
package.util-linux.archive.1 = @mirror.kernel@/utils/util-linux/@srctree@.tar.bz2
package.util-linux.commands = {{{
dkm_unpack

dkm_sed configure 's@/usr/include@/tmpsys/include@g'
dkm_launch ./configure
dkm_launch make -C lib
dkm_launch make -C mount mount umount
dkm_launch make -C text-utils more
dkm_launch make -C getopt
dkm_launch cp mount/{,u}mount text-utils/more getopt/getopt /tmpsys/bin

dkm_del sources
}}} package.util-linux.commands

# -----------------------------------------------------------------------------
# wget
package.wget.version = 1.10.2
package.wget.archive.1 = @mirror.gnu@/wget/@srctree@.tar.gz
package.wget.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.wget.commands

# -----------------------------------------------------------------------------
# xmlstarlet
package.xmlstarlet.version = 1.0.1
package.xmlstarlet.archive.1 = @mirror.sourceforge@/xmlstar/@srctree@.tar.gz
package.xmlstarlet.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys \
	--with-libxml-prefix=/tmpsys \
	--with-libxslt-prefix=/tmpsys
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.xmlstarlet.commands

# -----------------------------------------------------------------------------
# zlib
package.zlib.version = 1.2.3
package.zlib.archive.1 = @mirror.sourceforge@/libpng/@srctree@.tar.bz2
package.zlib.commands = {{{
dkm_unpack
dkm_launch ./configure \
	--prefix=/tmpsys \
	--shared \
	--libdir=/tmpsys/lib
dkm_launch make
dkm_launch make install
dkm_del sources
}}} package.zlib.commands

# vi:set ts=2 sw=2 noet syn=sh:
