Component Compilation Notes

By Paul A. Whittaker

Last Update: 1 January 2008


This file contains my instructions for compiling DIET-PC binaries. This is a work in progress; if you are viewing a copy of this file included with a DIET-PC source code bundle, please check the online version for updates. Instructions provided are intended for DIET-PC 2; software versions actually deployed in DIET-PC 1.1 may differ, and may require different workarounds or configuration parameters when building.

You're no doubt wondering why I don't have a complete CVS source code tree and a master Makefile that just builds everything. Well, there are two reasons for this: (i) it's too difficult, and (ii) it would slow the rate of change such that DIET-PC would have to use older versions of most software components. As you'll see below, DIET-PC builds of most software components are heavily modified, by DIET-PC-specific patches (I try to get my patches rolled in to the official releases in cases where the issue isn't DIET-PC-specific), or modified build procedures to produce "embedded-friendly" binaries, or both. In many cases, automation provided with the software distribution is too inaccurate for this sort of work, and binaries need to be relinked by hand without bogus dependencies introduced by "shotgun" automation. Needless to say, writing my own automation to resolve all of these issues would be immensely time consuming, so you're going to have to do some of the work manually instead.

The official build environment for DIET-PC is Debian: Woody (3.0) for DIET-PC 1.1, Etch (4.0) for DIET-PC 2, and Lenny (4.1) for DIET-PC 3. Historically Fedora Core 2 and 3 (x86) and Yellow Dog 4.1 (PowerPC) have been used, and some build instructions may not have been updated for Debian yet. If you choose not to use Debian, pay particular attention to the glibc requirements for each DIET-PC release: not greater than glibc 2.2.5 for DIET-PC 1.1, 2.3.6 for DIET-PC 2, and (at present) 2.6.1 for DIET-PC 3.

Ultimately I will ensure that all code compiles cleanly under gcc 4.x (although I use g++ 2.x to produce smaller C++ binaries), but for now gcc 3.x is probably the safer option.

One of the aims of DIET-PC is to be developer friendly; I don't want to force developers to use a dedicated build environment if this can be avoided. I try to keep DIET-PC reasonably up-to-date with current software versions (even if this causes some bloat), so that straightforward transplantation of binaries compiled on the likewise reasonably-up-to-date Linux distro that you are hopefully using stands the best possible chance of success.

Nevertheless, it's likely that in some places my instructions are not going to work for distros other than Debian. If you're reasonably familiar with compilation tools you should be able to sort out any minor differences. Pay close attention to shared library dependencies - DIET-PC does not have a full range of shared libraries. If you end up with a binary that needs a library that DIET-PC doesn't have (use "ldd" to show dependencies), either recompile it without the feature that introduces that dependency (typically using a --without-xyz or --disable-xyz GNU configure option), or if you can't do that, link the binary manually with that particular library static, using "-Wl,-Bstatic -llibrary -Wl,-Bdynamic". In some cases, such as when a library is loaded by an application rather than via the dynamic linker (eg. libdvdcss), it may prove necessary to compile and include that shared library in your DIET-PC build. Beware of dynamic linkage of libgcc_s.so.1 under some circumstances and with certain versions of gcc (I want to avoid adding this library to DIET-PC (or DIET-PC 2, at least)). This behaviour can be suppressed by adding the "-static-libgcc" option to CFLAGS or similar.

Gentoo might not be a suitable choice for a development environment if you intend to deploy to a diverse range of hardware. This is because any static library that you link against is likely to have been compiled for the specific instruction set of the Gentoo host's CPU (i.e. -march=xxx) and consequently the code you produce will not run on older hardware.

It is assumed that ~/diet-pc-src contains all relevant downloadable source code objects (tarballs, DIET-PC patches, config file templates). The target directory tree is assumed to be located at ~/diet-pc. For best performance, I recommend performing the actual compilation in a tmpfs filesystem (/tmp or /dev/shm).

I have not provided URLs for most source code distributions, as this is too much of a moving target. You can almost always find the source by doing a project search at freshmeat.net. In cases where you can't, I will endeavour to provide a URL.

The current user is assumed to be root, with a BASH shell. The shell's umask is assumed to be 022. It isn't necessary to compile as root, it's just more convenient for installing. If your distro's root shell environment aliases the cp, mv and rm commands to force usage of the "-i" (interactive) flag for safety, you you should remove these aliases (eg. "unalias cp") before attempting to cut and paste multiple lines from this webpage.

To avoid repeating myself, all of the instructions below now assume that you have set CFLAGS and CXXFLAGS environment variables appropriately for embedded compilation for your platform. The easiest way to do this is to add the following to your ~/.bashrc file:

case "`uname -m`" in
*86)
    # DIET-PC 3: use '-march=i486 -mtune=i686' instead
    TUNING='-mtune=i686'
    ;;
x86_64)
    TUNING='-m64'
    ;;
ppc)
    TUNING='-mtune=powerpc'
    ;;
arm*)
    # ARM EABI: use '-mabi=eabi' instead
    TUNING='-mtune=strongarm'
    ;;
mips)
    TUNING='-mtune=r4000'
    ;;
esac
export CFLAGS="-Os $TUNING"
[ "`which g++-2.95`" ] && export CXX='g++-2.95'
export CXXFLAGS="$CFLAGS"

In comments in the build procedure, I use $CFLAGS as shorthand for what is set above, even in contexts where the literal string "$CFLAGS" is not understood. When editing files, substitute what $CFLAGS evaluates to (i.e. the output of the shell command "echo $CFLAGS") rather than the literal string "$CFLAGS". Failure to set $CFLAGS correctly will not prevent compilation from succeeding, it will just result in a binary that is suboptimal for DIET-PC use (-Os avoids optimisations that result in bigger binaries; -mtune=XXX tries to make the code run most efficiently for the named processor class while not excluding other processor types (which is what -march=XXX does)).

Instructions assume Intel 80x86 architecture by default. Where the above environment variable differences are not sufficient to cater to other platforms and there is a platform-specific variation to the procedure, obey the comments provided.

It shouldn't make any difference, but FYI, my ARM build platform is a ThinLinx Hot-e HL200 (an ARM920T-based SBC), my PowerPC build platform is an Aluminium G4 Powerbook (7400 series CPU), and my x86/x86_64 build platform is an Intel Core 2 Duo 2.66 GHz based on an ASUS P5KC mainboard. It is possible to use cross-compilers, but I have a strong preference for native or emulated compilation, to avoid oversights and complications. Native compilation can be emulated using QEMU ("integratorcp926" for ARM, "prep" for PPC and "mips" for MIPSEL); if you have a fast x86 CPU this may even be faster than using real hardware in some cases (eg. ARM and MIPSEL).


Index


acpid 1.0.6

tar xzf ~/diet-pc-src/acpid-1.0.6.tar.gz
cd acpid-1.0.6
vi Makefile	# Substitute $CFLAGS for "-g" in CFLAGS
make
strip -R .note -R .comment acpid
mkdir -p ~/diet-pc/shell/files/usr/sbin
cp acpid ~/diet-pc/shell/files/usr/sbin/
~/diet-pc/tools/man2txt acpid.8 >~/diet-pc/shell/acpid.txt

alsa-lib 1.0.15

tar xjf ~/diet-pc-src/alsa-lib-1.0.15.tar.bz2
cd alsa-lib-1.0.15
./configure --prefix=/usr --sysconfdir=/etc
make
strip -R .note -R .comment src/.libs/libasound.so.2
mkdir -p ~/diet-pc/mmedia_xine/files/usr/lib
cp src/.libs/libasound.so.2 ~/diet-pc/mmedia_xine/files/usr/lib/
mkdir -p ~/diet-pc/mmedia_xine/files/usr/share/alsa
cd src/conf
cp -r * ~/diet-pc/mmedia_xine/files/usr/share/alsa/
find  ~/diet-pc/mmedia_xine/files/usr/share/alsa -name Makefile\* -exec rm {} \;
cd ../../..
rm -rf alsa-lib-1.0.15

apmd 3.2.2

Debian has taken responsibility for this otherwise defunct project. Official sources are available at ftp://ftp.debian.org/debian/pool/main/a/apmd/.

tar xzf ~/diet-pc-src/apmd_3.2.2.orig.tar.gz
cd apmd-3.2.2.orig
make CFLAGS="$CFLAGS"
gcc -o apm .libs/apm.o .libs/libapm.a
gcc -o apmd .libs/apmd.o .libs/libapm.a
strip -R .note -R .comment apm apmd
mkdir -p ~/diet-pc/shell/extras
cp apm apmd ~/diet-pc/shell/extras/
~/diet-pc/tools/man2txt apm.1 >~/diet-pc/shell/extras/apm.txt
~/diet-pc/tools/man2txt apmd.8 >~/diet-pc/shell/extras/apmd.txt
cd ..
rm -rf apmd-3.2.2.orig

aumix 2.8

tar xjf ~/diet-pc-src/aumix-2.8.tar.bz2
cd aumix-2.8
# DIET-PC 3: use --prefix='' instead.
./configure --prefix=/usr --sysconfdir=/etc --without-gtk --without-gtk1 \
	--without-gpm --without-ncurses --disable-nls
# Note that aumix 2.8 will not use ALSA hardware mute support regardless of
# configure finds, so the format and version of your libasound is not relevant
# here.
make
strip -R .note -R .comment src/aumix
mkdir -p ~/diet-pc/shell/files/usr/bin
cp src/aumix ~/diet-pc/shell/files/usr/bin/
cd ..
rm -rf aumix-2.8

autofs 4.1.4

tar xjf ~/diet-pc-src/autofs-4.1.4.tar.bz2
cd autofs-4.1.4
for patch in  ~/diet-pc-src/autofs-4.1.4-*.patch.bz2; do
	bunzip2 -c $patch | patch -p1 -E
done
vi Makefile.rules	# modify CFLAGS as required (-O3 to -Os, add -mtune=xxx)
./configure --prefix=/usr --sysconfdir=/etc
make
strip -R .note -R .comment daemon/automount modules/*.so
mkdir -p ~/diet-pc/storageserver/files/usr/sbin
mkdir -p ~/diet-pc/storageserver/files/usr/lib/autofs
cp daemon/automount ~/diet-pc/storageserver/files/usr/sbin/
cp modules/{lookup_file,mount_bind,mount_generic,mount_nfs,parse_sun}.so \
	~/diet-pc/storageserver/files/usr/lib/autofs/
~/diet-pc/tools/man2txt man/autofs.5 >~/diet-pc/storageserver/autofs.txt
~/diet-pc/tools/man2txt man/automount.8 >~/diet-pc/storageserver/automount.txt
cd ..
rm -rf autofs-4.1.4

binutils 2.18

tar xjf ~/diet-pc-src/binutils-2.18.tar.bz2
cd binutils-2.18
./configure --prefix=/usr --sysconfdir=/etc --target=i386-dietpc-linux-gnu
make
strip -R .note -R .comment binutils/strip-new
mkdir -p ~/diet-pc/assembler_installer/files/usr/bin
cp binutils/strip-new ~/diet-pc/assembler_installer/files/usr/bin/strip
cd ..
rm -rf binutils-2.18

bootsplash 3.1

Previously I had used the bootsplash.de fork because bootsplash.org was not being updated, but this situation has now reversed, so I have reverted to the latter.

The bootsplash project has now been superceded by splashy, but DIET-PC 2 must continue to use bootsplash for backward compatibility.

tar xjf ~/diet-pc-src/bootsplash-3.1.tar.bz2
cd bootsplash-3.1/Utilities
make splash CFLAGS="$CFLAGS"
strip -R .note -R .comment splash
mkdir -p ~/diet-pc/tools
cp splash ~/diet-pc/tools/
cd ../..
rm -rf bootsplash-3.1

busybox 1.8.2

tar xjf ~/diet-pc-src/busybox-1.8.2.tar.bz2
cd busybox-1.6.1
bunzip2 -c ~/diet-pc-src/busybox-1.3.1-dietpc-patch.bz2 | patch -p1
cp ~/diet-pc-src/dietpc_bbconfig-1.8.1 .config
make menuconfig		# Just save and exit unless you wish to change anything
make
mkdir -p ~/diet-pc/shell/files/bin
cp busybox ~/diet-pc/shell/files/bin/
cd ..
rm -rf busybox-1.8.2

cdrtools 2.01

tar xjf ~/diet-pc-src/cdrtools-2.01.tar.bz2
cd cdrtools-2.01
chmod u+w RULES/i686-linux-gcc.rul
vi RULES/i686-linux-gcc.rul	# change COPTOPT=$CFLAGS
# (PPC: Modify RULES/ppc-linux-gcc.rul instead)
# (ARM: Modify RULES/armv4l-linux-gcc.rul instead)
# (x86_64: Modify RULES/x86_64-linux-gcc.rul instead)
# (MIPSEL: Modify RULES/mipsel-linux-gcc-rul instead)
vi DEFAULTS/Defaults.linux	# set DEFCCOM=gcc LDPATH= RUNPATH=
				# INS_BASE=/usr)
make
# (ARM: the above command may fail, if so create a symbolic link to
# RULES/armv4l-linux-gcc.rul for the required name and run make again, eg.
# "ln -s armv4l-linux-gcc.rul RULES/armv4tl-linux-gcc.rul".)
strip -R .note -R .comment rscsi/OBJ/*/rscsi cdrecord/OBJ/*/cdrecord \
        mkisofs/OBJ/*/mkisofs
mkdir -p ~/diet-pc/storageserver/files/usr/sbin
mkdir -p ~/diet-pc/storageserver/files/opt
cp rscsi/OBJ/*/rscsi ~/diet-pc/storageserver/files/usr/sbin/
chmod 4755 ~/diet-pc/storageserver/files/usr/sbin/rscsi
ln -s ../usr ~/diet-pc/storageserver/files/opt/schily
mkdir -p ~/diet-pc/assembler_installer/files/usr/bin
cp cdrecord/OBJ/*/cdrecord mkisofs/OBJ/*/mkisofs \
        ~/diet-pc/assembler_installer/files/usr/bin/
cd ..
rm -rf cdrtools-2.01

checkhostname

This is a homegrown helper utility. Source code is available from the DIET-PC downloads area.

gcc $CFLAGS -Wall -o checkhostname ~/diet-pc-src/checkhostname.c
strip -R .note -R .comment checkhostname
mkdir -p ~/diet-pc/shell/files/bin
mv checkhostname ~/diet-pc/shell/files/bin/

console-data 1999.08.29

Prerequisite: Compile and install Busybox first.

Appears as "linuxconsoledata" on Freshmeat.

FIXME: this command sequence doesn't work unprivileged.

tar xzf ~/diet-pc-src/console-data_1999.08.29.orig.tar.gz
cd console-data-1999.08.29
mkdir -p ~/diet-pc/shell/files/lib/kbd/consolefonts
cp consolefonts/default8x16.psf \
	~/diet-pc/shell/files/lib/kbd/consolefonts/default.psf
	# or other file as required for your locale
cd keymaps/i386
for kmap in `find . -name \*.kmap -print`; do
    loadkeys $kmap
    ~/diet-pc/shell/files/bin/busybox dumpkmap >\
	    `echo $kmap | sed 's/kmap$/bkmap/'`
done; loadkeys -d
mkdir -p ~/diet-pc/shell/extras/kmaps
find .  -name \*.bkmap -print | tar cTf - - | tar xCf \
        ~/diet-pc/shell/extras/kmaps -
mkdir -p ~/diet-pc/shell/files/lib/kbd/kmaps
cp qwerty/us.bkmap ~/diet-pc/shell/files/lib/kbd/kmaps/default.bkmap
    # or other file as required for your locale
cd ../../..
rm -rf console-data-1999.08.29

coreutils 6.9

tar xjf ~/diet-pc-src/coreutils-6.9.tar.bz2
cd coreutils-6.9
./configure --prefix=/usr --sysconfdir=/etc --disable-nls
make -C lib
make -C src df
strip -R .note -R .comment src/df
mkdir -p ~/diet-pc/assembler_installer/files/bin
cp src/df ~/diet-pc/assembler_installer/files/bin/
cd ..
rm -rf coreutils-6.9

cpio 2.9

tar xjf ~/diet-pc-src/cpio-2.9.tar.bz2
cd cpio-2.9
./configure --prefix='' --with-rmt=/etc/rmt --disable-nls
make
strip -R .note -R .comment src/cpio
mkdir -p ~/diet-pc/assembler_installer/files/bin
cp src/cpio ~/diet-pc/assembler_installer/files/bin/
cd ..
rm -rf cpio-2.9

cryptmd5

cryptmd5 is an example program from the glibc manual.

gcc $CFLAGS -Wall -o cryptmd5 ~/diet-pc-src/cryptmd5.c -lcrypt
strip -R .note -R .comment cryptmd5
mkdir -p ~/diet-pc/shell/extras
mv cryptmd5 ~/diet-pc/shell/extras/

dosfstools 2.11

Dosfstools seems to lack an authoritative home page. SUSE Linux claims that ftp://ftp.uni-erlangen.de/pub/Linux/LOCAL/dosfstools is the offical site.
tar xzf ~/diet-pc-src/dosfstools-2.11.src.tar.gz
cd dosfstools-2.11
vi Makefile		# change OPTFLAGS as required (-O2 to -Os, add
			# -mtune=xxx)
make
strip -R .note -R .comment dosfsck/dosfsck mkdosfs/mkdosfs
mkdir -p ~/diet-pc/persistfs/files/sbin
cp dosfsck/dosfsck ~/diet-pc/persistfs/files/sbin/fsck.vfat
cp mkdosfs/mkdosfs ~/diet-pc/persistfs/files/sbin/mkfs.vfat
cd ..
rm -rf dosfstools-2.11

dropbear 0.50

tar xjf ~/diet-pc-src/dropbear-0.50.tar.bz2
cd dropbear-0.50
# DIET-PC 3: use --prefix='' instead.
./configure --prefix=/usr --sysconfdir=/etc
vi Makefile	# change "-lutil" to "-Wl,-Bstatic -lutil -Wl,-Bdynamic" in LIBS
# DIET-PC 3 only:
#vi options.h	# change XAUTH_COMMAND to "/usr/bin/xauth -q" and
		# _PATH_SSH_PROGRAM to "/bin/dbclient" and
		# #undef SFTPSERVER_PATH
make
make scp
strip -R .note -R .comment dropbear dropbearconvert dropbearkey dbclient scp
mkdir -p ~/diet-pc/sshserver/files/usr/sbin ~/diet-pc/sshserver/extras \
	~/diet-pc/sshserver/files/sbin
cp dropbear ~/diet-pc/sshserver/files/usr/sbin/
cp scp ~/diet-pc/sshserver/files/sbin/
cp dropbearconvert dropbearkey dbclient ~/diet-pc/sshserver/extras/
~/diet-pc/tools/man2txt dropbear.8 >~/diet-pc/sshserver/dropbear.txt
~/diet-pc/tools/man2txt dropbearkey.8 \
	>~/diet-pc/sshserver/extras/dropbearkey.txt
~/diet-pc/tools/man2txt dbclient.1 >~/diet-pc/sshserver/extras/dbclient.txt
cd ..
rm -rf dropbear-0.50

dump 0.4b41

tar xzf ~/diet-pc-src/dump-0.4b41.tar.gz
cd dump-0.4b41
./configure --prefix='' --with-cc-opts="$CFLAGS" --enable-rmt
make -C compat/lib
make -C rmt GLIBS='-L../compat/lib -lcompat'
strip -R .note -R .comment rmt/rmt
mkdir -p ~/diet-pc/storageserver/files/usr/sbin
mkdir -p ~/diet-pc/storageserver/files/etc
cp rmt/rmt ~/diet-pc/storageserver/files/usr/sbin/
ln -s ../usr/sbin/rmt ~/diet-pc/storageserver/files/etc/rmt
cd ..
rm -rf dump-0.4b41

e2fsprogs 1.40.3

The patch to add ext2 compression support is available from http://e2compr.sourceforge.net.
tar xjf ~/diet-pc-src/e2fsprogs-1.40.3.tar.bz2
cd e2fsprogs-1.40.3
bunzip2 -c ~/diet-pc-src/e2fsprogs-1.40.3-e2compr-0.4.12-0.diff.bz2 | patch \
	-p1 -b
bunzip2 -c ~/diet-pc-src/e2fsprogs-1.40.3-dietpc-patch.bz2 | patch -p1 -b
# DIET-PC 3: use --prefix='' instead.
./configure --prefix=/usr --sbindir=/sbin --with-ccopts="$CFLAGS" \
	--enable-compression --enable-fsck --enable-dynamic-e2fsck \
	--disable-nls
make
strip -R .note -R .comment e2fsck/e2fsck.shared resize/resize2fs \
	misc/{fsck,mke2fs,chattr,lsattr,badblocks,dumpe2fs,e2image,tune2fs,blkid}
mkdir -p ~/diet-pc/assembler_installer/files/sbin
mkdir -p ~/diet-pc/persistfs/files/sbin ~/diet-pc/persistfs/extras
mkdir -p ~/diet-pc/persistfs/files/usr/bin
mkdir -p ~/diet-pc/storageserver/files/usr/sbin
mkdir -p ~/diet-pc/tools ~/diet-pc/tools-doc
cp e2fsck/e2fsck.shared ~/diet-pc/persistfs/files/sbin/fsck.ext2
ln -s fsck.ext2 ~/diet-pc/persistfs/files/sbin/fsck.ext3
cp misc/fsck ~/diet-pc/persistfs/files/sbin/
cp misc/mke2fs ~/diet-pc/assembler_installer/files/sbin/mkfs.ext2
ln -s mkfs.ext2 ~/diet-pc/assembler_installer/files/sbin/mke2fs
cp misc/mke2fs ~/diet-pc/persistfs/files/sbin/mkfs.ext2
ln -s mkfs.ext2 ~/diet-pc/persistfs/files/sbin/mkfs.ext3
cp misc/{lsattr,chattr} ~/diet-pc/persistfs/files/usr/bin/
cp misc/{lsattr,chattr} ~/diet-pc/tools/
cp misc/{badblocks,dumpe2fs,e2image,tune2fs} ~/diet-pc/persistfs/extras/
cp resize/resize2fs ~/diet-pc/persistfs/extras/
cp misc/blkid ~/diet-pc/storageserver/files/usr/sbin/
~/diet-pc/tools/man2txt misc/chattr.1 >\
	~/diet-pc/tools-doc/chattr.txt
~/diet-pc/tools/man2txt misc/lsattr.1 >\
	~/diet-pc/tools-doc/lsattr.txt
cd ..
rm -rf e2fsprogs-1.40.3

e3 2.7.0

tar xzf ~/diet-pc-src/e3-2.7.0.tar.gz
cd e3-2.7.0
make
# (PPC, ARM, x86_64 and MIPSEL: build the alternate C version as follows:
# vi e3c/e3.c	# Change "#define POP(arg) arg=(typeof(arg))(*esp--)"
		# Change line 1306 to "ebp=(unsigned char *)((long)ebp+eax);"
# make -C e3c PREFIX=/usr CFLAGS="$CFLAGS"
# strip -R .note -R .comment e3c/e3c
# ln -s e3c/e3c e3
# ... but you may find that it is too buggy to use!)
mkdir -p ~/diet-pc/assembler_installer/files/bin
mkdir -p ~/diet-pc/shell/extras
cp e3 ~/diet-pc/assembler_installer/files/bin/
cp e3 ~/diet-pc/shell/extras/
~/diet-pc/tools/man2txt e3.man >~/diet-pc/assembler_installer/e3.txt
cd ..
rm -rf e3-2.7.0

ed 0.8

Busybox's ed applet is not quite up to the task ...

tar xjf ~/diet-pc-src/ed-0.8.tar.bz2
cd ed-0.8
./configure --prefix=''
vi Makefile	# Change -O2 to $CFLAGS in CFLAGS
make
strip -R .note -R .comment ed
mkdir -p ~/diet-pc/assembler_installer/files/bin
cp ed ~/diet-pc/assembler_installer/files/bin/
cd ..
rm -rf ed-0.8

EsounD 0.2.38

tar xjf ~/diet-pc-src/esound-0.2.38.tar.bz2
cd esound-0.2.38
./configure --prefix=/usr --sysconfdir=/etc --disable-shared --with-libwrap \
	--disable-alsa  	# ALSA causes too much bloat - sorry!
make esd AUDIOFILE_LIBS='/usr/lib/libaudiofile.a -lm' LIBS=''
strip -R .note -R .comment esd
mkdir -p ~/diet-pc/shell/files/usr/sbin
cp esd ~/diet-pc/shell/files/usr/sbin/
~/diet-pc/tools/man2txt docs/esd.1 >~/diet-pc/shell/esd.txt
cd ..
rm -rf esound-0.2.38

ethtool 6

tar xzf ~/diet-pc-src/ethtool-6.tar.gz
cd ethtool-6
./configure --prefix=''
make
strip -R .note -R .comment ethtool
mkdir -p ~/diet-pc/shell/files/sbin
cp ethtool ~/diet-pc/shell/files/sbin/
~/diet-pc/tools/man2txt ethtool.8 >~/diet-pc/shell/ethtool.txt
cd ..
rm -rf ethtool-6

evilwm 0.99.17

tar xzf ~/diet-pc-src/evilwm_0.99.17.orig.tar.gz
cd evilwm-0.99.17.orig
bunzip2 -c ~/diet-pc-src/evilwm-0.99.17-dietpc-patch.bz2 | patch -p1 -b
vi Makefile	# change CFLAGS as required
make
strip -R .note -R .comment evilwm
mkdir -p ~/diet-pc/xcore/files/usr/X11R6/bin
cp evilwm ~/diet-pc/xcore/files/usr/X11R6/bin/
~/diet-pc/tools/man2txt evilwm.1 >~/diet-pc/xcore/evilwm.txt
cd ..
rm -rf evilwm-0.99.17.orig

getnetmask

This is a homegrown helper utility. Source code is available from the DIET-PC downloads area.

gcc $CFLAGS -Wall -o getnetmask ~/diet-pc-src/getnetmask.c
strip -R .note -R .comment getnetmask
mkdir -p ~/diet-pc/shell/files/bin
mv getnetmask ~/diet-pc/shell/files/bin/

glibc 2.3.6

If you are compiling under Debian Etch, please install gawk and ensure that /etc/alternatives/awk points to this. Mawk will not work with some of the complex awk scripts that the glibc build automation uses.

Debian glibc patches can be found in the debian/pool/main/g/glibc/ subdirectory on any Debian mirror.

tar xjf ~/diet-pc-src/glibc-2.3.6.tar.bz2
cd glibc-2.3.6
tar xjf ~/diet-pc-src/glibc-linuxthreads-2.3.6.tar.bz2
# In earlier versions, it was necessary to move "#include <useldt.h>"
# outside the #ifdef in linuxthreads/sysdeps/i386/tls.h.  2.3.5 and later
# don't need this.
#
# Unfortunately most non-x86 architectures need a lot of unofficial patches.
# Since Debian is one of the most portable distros, and also the reference
# DIET-PC development platform, we'll use their patch set.  Ensure that you
# have "quilt" installed before proceeding.
gunzip -c ~/diet-pc-src/glibc_2.3.6.ds1-13etch4.diff.gz | patch -p1
ln -s debian/patches
vi patches/series	# Change "-p1" to "-p2" on "hppa/cvs-clone.diff" line
# ARM platform only:
#mkdir .pc.arm-softfloat
#cp patches/series.arm-softfloat .pc.arm-softfloat/series
#env QUILT_PC=.pc.arm-softfloat quilt upgrade
#env QUILT_PC=.pc.arm-softfloat quilt push -a
mv manual/Makefile manual/Makefile.old
quilt push -a
mkdir ../glibc-build
cd ../glibc-build
../glibc-2.3.6/configure --prefix=/usr --enable-add-ons=linuxthreads \
	--disable-profile --enable-kernel=2.2.0 --with-tls --without-__thread \
	--with-headers=/usr/include --build=i386-dietpc-linux-gnu
# (x86_64: omit --without-__thread, change --build=x86_64-dietpc-linux-gnu
# (PPC: omit --without-__thread, change --build=ppc-dietpc-linux-gnu)
# (ARM: omit --without-__thread, change --build=arm-dietpc-linux-gnu, add
# --without-fp)
# (MIPSEL: omit --without-__thread, change --build=mipsel-dietpc-linux-gnu)
make
strip -R .note -R .comment libc.so.6 elf/{ldconfig,ld-linux.so.2} \
	crypt/libcrypt.so.1 dlfcn/libdl.so.2 math/libm.so.6 nis/libnsl.so.1 \
	resolv/{libnss_dns.so.2,libresolv.so.2} nss/libnss_files.so.2 \
	linuxthreads/libpthread.so.0 rt/librt.so.1
# (PPC and MIPSEL: change ld-linux.so.2 to ld.so.1)
# (ARM EABI: change ld-linux.so.2 to ld-linux.so.3)
# (x86_64: change ld-linux.so.2 to ld-linux-x86-64.so.2)
mkdir -p ~/diet-pc/shell/files/lib ~/diet-pc/shell/extras
mkdir -p ~/diet-pc/shell/files/usr/bin
mkdir -p ~/diet-pc/assembler_installer/files/sbin
mkdir -p ~/diet-pc/mmedia_xine/files/lib
cp libc.so.6 elf/ld-linux.so.2 crypt/libcrypt.so.1 dlfcn/libdl.so.2 \
	math/libm.so.6 nis/libnsl.so.1 resolv/{libnss_dns.so.2,libresolv.so.2} \
	nss/libnss_files.so.2 linuxthreads/libpthread.so.0 \
	~/diet-pc/shell/files/lib/
# (PPC and MIPSEL: change ld-linux.so.2 to ld.so.1)
# (ARM EABI: change ld-linux.so.2 to ld-linux.so.3)
# (x86_64: change ld-linux.so.2 to ld-linux-x86-64.so.2)
chmod u+w elf/ldd
vi elf/ldd	# Substitute "true" for "set -o pipefail".
		# Inconsiderate bastards.
cp elf/ldd ~/diet-pc/shell/files/usr/bin/
cp elf/ldconfig rt/librt.so.1 ~/diet-pc/shell/extras/
cp rt/librt.so.1 ~/diet-pc/mmedia_xine/files/lib/
cp elf/ldconfig ~/diet-pc/assembler_installer/files/sbin/
cd ..
tar cjf glibc-build.tar.bz2 glibc-build	# Retain a copy of this in case you
					# need to borrow more libraries from it
					# at a later date
rm -rf glibc-build glibc-2.3.6

gpm 1.20.1

tar xjf ~/diet-pc-src/gpm-1.20.1.tar.bz2
cd gpm-1.20.1
./configure --without-ncurses --prefix=/usr --sysconfdir=/etc
make -C src gpm LIBS=-lm
strip -R .note -R .comment src/gpm
mkdir -p ~/diet-pc/shell/files/usr/sbin
cp src/gpm ~/diet-pc/shell/files/usr/sbin/
cd ..
rm -rf gpm-1.20.1

grub 0.97

The DIET-PC GRUB build uses Debian patches, primarily for the splash graphic feature. I have further modified GRUB with a patch by Sylvain Fourmanoit sourced from a bugtracker on Savannah (possibly still available here) to add a Vendor Class Identifier - "GRUBClient" - to its DHCP requests, so that you can configure DHCP servers to limit or customise responses to GRUB clients.

The grub_netdriver_list.txt file can be found in the DIET-PC source code tarball or separately here.

GRUB is specific to the x86 and x86_64 ports of DIET-PC. It is not 64-bit safe and must be compiled 32-bit. Nor is it gcc4-safe, apparently!

tar xzf ~/diet-pc-src/grub-0.97.tar.gz
cd grub-0.97
gunzip -c ~paw/grub_0.97-28.diff.gz | patch -p1
sed -e '/^#/d' -e '/^$/d' debian/patches/00list | while read patch do
    patch -p1 < debian/patches/$patch
done
bunzip2 -c ~/diet-pc-src/grub-0.97-3c90x_9058.patch.bz2 | patch -p1 -b
CC=gcc-2.95 CFLAGS=-Os ./configure --prefix='' --disable-auto-linux-mem-opt \
	--without-curses
vi +57 netboot/main.c   # Fix needed for gcc 4.x:
			# change global variables bootp_data (line 57) and
			# end_of_rfc1533 (line 59) to non-static, by removing
			# the word "static" from the relevant lines
vi +3708 stage2/builtins.c	# Fix needed for gcc 2.x:
				# Enclose "char *tmp;" and the if statement
				# that follows it in a block (ie. { ... })
make
strip -R .note -R .comment grub/grub
mkdir -p ~/diet-pc/tools ~/diet-pc/tools-doc
mkdir -p ~/diet-pc/templates/grub/boot/grub
cp grub/grub ~/diet-pc/tools/
cp docs/grub.info ~/diet-pc/tools-doc/
~/diet-pc/tools/man2txt docs/grub.8 >~/diet-pc/tools-doc/grub.txt
cp stage1/stage1 stage2/{stage2,e2fs_stage1_5,fat_stage1_5} \
	~/diet-pc/templates/grub/boot/grub/
cat >menu.lst <<EOF
default 0
fallback 1
timeout 0
title netboot
	dhcp --with-configfile
title fail
	halt --no-apm
EOF
mkdir -p ~/diet-pc/templates/netgrub/diet-pc/grub
unalias cp	# If required
while read SUFFIX EXTRA_ARGS; do
    make clean
    ./configure --prefix='' --disable-linux-auto-mem-opt --enable-diskless \
	    --enable-preset-menu=menu.lst ${EXTRA_ARGS}
    make -C netboot libdrivers.a
    make -C stage2 diskless
    make -C stage2 nbgrub
    make -C stage2 pxegrub
    cp stage2/nbgrub \
	    ~/diet-pc/templates/netgrub/diet-pc/grub/nbgrub.${SUFFIX}
    cp stage2/pxegrub \
	    ~/diet-pc/templates/netgrub/diet-pc/grub/pxegrub.${SUFFIX}
done < ~/diet-pc-src/grub_netdriver_list.txt
cd ..
rm -rf grub-0.97

hfsplus 1.0.4

hfsplus is specific to the PowerPC port of DIET-PC. Copies can be found at http://penguinppc.org/historical/hfsplus/, although this no longer appears to be an authoritative page.

tar xjf ~/diet-pc-src/hfsplus_1.0.4.src.tar.bz2
cd hfsplus-1.0.4
make -f Makefile.cvs	# Ignore the error about ltmain.sh.
ln -s /usr/bin/libtool
./configure --prefix=/usr --sysconfdir=/etc --disable-shared
vi +19 libhfsp/src/unicode.c	# Change "<linux/string.h>" to "<string.h>"
vi +51 src/glob.c		# Change "case NULL:" to "case '\0':"
vi src/hpmkdir.c		# Add "#include <errno.h>"
make -C libhfsp/src CFLAGS="$CFLAGS"
vi libhfsp/src/libhfsp.la	# Comment out dlname and library_names
make -C src CFLAGS="$CFLAGS"
cd src
strip -R .note -R .comment hpcd hpcopy hpfsck hpls hpmkdir hpmount hppwd hprm \
	hpumount
mkdir -p ~/diet-pc/assembler_installer/files/usr/bin
mkdir -p ~/diet-pc/persistfs/files/sbin
cp hpcd hpcopy hpls hpmkdir hpmount hppwd hprm hpumount \
	~/diet-pc/assembler_installer/files/usr/bin/
cp hpfsck ~/diet-pc/persistfs/files/sbin/fsck.hfsplus
cd ../..
rm -rf hfsplus-1.0.4

hfsutils 3.2.6

hfsutils is specific to the PowerPC port of DIET-PC.

tar xzf ~/diet-pc-src/hfsutils-3.2.6.tar.gz
cd hfsutils-3.2.6
./configure --prefix=/usr --sysconfdir=/etc
make
make -C hfsck
strip -R .note -R .comment hfsutil hfsck/hfsck
mkdir -p ~/diet-pc/assembler_installer/files/usr/bin
mkdir -p ~/diet-pc/persistfs/files/sbin
cp hfsutil ~/diet-pc/assembler_installer/files/usr/bin/
for link in hattrib hcd hcopy hdel hdir hformat hls hmkdir hmount hpwd \
	hrename hrmdir humount hvol; do
    ln -s hfsutil ~/diet-pc/assembler_installer/files/usr/bin/$link
done
cp hfsck/hfsck ~/diet-pc/persistfs/files/sbin/fsck.hfs
cd ..
rm -rf hfsutils-3.2.6

imwheel 1.0.0pre12

Ensure that you have static versions of libXtst, libXmu, and libXt. If you don't, you may need to compile XFree86 / X.Org as per this file and install it on your development environment as well.
tar xzf ~/diet-pc-src/imwheel-1.0.0pre12.tar.gz
cd imwheel-1.0.0pre12
./configure --prefix=''
vi Makefile	# change "imwheel_LDADD = -L$(top_builddir)/jax -ljax
		# -L/usr/X11R6/lib -Wl,-Bstatic -lXtst -lXmu
		# -lXt -Wl,-Bdynamic -lXext -lX11"
make
strip -R .note -R .comment imwheel
mkdir -p ~/diet-pc/xcore/extras
cp imwheel imwheelrc ~/diet-pc/xcore/extras/
~/diet-pc/tools/man2txt imwheel.1 >~/diet-pc/xcore/extras/imwheel.txt
cd ..
rm -rf imwheel-1.0.0pre12

jpegsrc 6b

Appears as "libjpeg" on Freshmeat.

tar xzf ~/diet-pc-src/jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr --enable-shared
make
# (ARM and x86_64: make LIBTOOL=libtool)
strip -R .note -R .comment .libs/libjpeg.so.62
mkdir -p ~/diet-pc/ica/files/usr/lib
mkdir -p ~/diet-pc/rfb/files/usr/lib
mkdir -p ~/diet-pc/xserver_xorg_vnc/files/usr/lib
mkdir -p ~/diet-pc/xserver_xvnc/files/usr/lib
cp .libs/libjpeg.so.62 ~/diet-pc/ica/files/usr/lib/
cp .libs/libjpeg.so.62 ~/diet-pc/rfb/files/usr/lib/
cp .libs/libjpeg.so.62 ~/diet-pc/xserver_xorg_vnc/files/usr/lib/
cp .libs/libjpeg.so.62 ~/diet-pc/xserver_xvnc/files/usr/lib/
cd ..
rm -rf jpeg-6b

kbd 1.12

If anyone can give me a convincing explanation as to why console-tools is superior to kbd, I'll consider using that instead. Mainstream Linux distros seem divided on this issue for no obvious reason.

tar xzf ~/diet-pc-src/kbd-1.12.tar.gz
cd kbd-1.12
./configure --prefix=/usr
vi defines.h		# change to "#undef ENABLE_NLS"
vi src/Makefile		# change to CFLAGS=$CFLAGS
make -C src setleds
strip -R .note -R .comment src/setleds
mkdir -p ~/diet-pc/shell/files/usr/bin
cp src/setleds ~/diet-pc/shell/files/usr/bin/
cd ..
rm -rf kbd-1.12

libdvdcss 1.2.9

tar xjf ~/diet-pc-src/libdvdcss-1.2.9.tar.bz2
cd libdvdcss-1.2.9
tar xjOf ~/diet-pc-src/xine-lib-1.1.8.tar.bz2 \
	xine-lib-1.1.8/misc/libdvdcss-1.2.6-network.patch | patch -p1 -b
# If you have automake 1.10 or later you will need to replace the stupid
# lexical comparison in the bootstrap script with one that actually works:
# vi bootstrap	# Replace "if expr "$amvers ..." line with
		# if [ "`echo $amvers | cut -f2 -d.`" -lt 5 ]; then
./bootstrap
./configure --disable-static
make
strip -R .note -R .comment src/.libs/libdvdcss.so.2
mkdir -p ~/diet-pc/mmedia_xine/files/usr/lib
cp src/.libs/libdvdcss.so.2 ~/diet-pc/mmedia_xine/files/usr/lib/
cd ..
rm -rf libdvdcss-1.2.9

lilo 22.8.0

LILO is specific to the x86 and x86_64 ports of DIET-PC.

tar xzf ~/diet-pc-src/lilo-22.8.tar.gz
cd lilo-22.8
vi Makefile	# remove -g from CFLAGS assignment, change OPT=$CFLAGS
make
strip -R .note -R .comment lilo
mkdir -p ~/diet-pc/tools ~/diet-pc/tools-doc
cp lilo ~/diet-pc/tools/
~/diet-pc/tools/man2txt manPages/lilo.8 >~/diet-pc/tools-doc/lilo.txt
~/diet-pc/tools/man2txt manPages/lilo.conf.5 >\
	~/diet-pc/tools-doc/lilo.conf.txt
cd ..
rm -rf lilo-22.8

Linux 2.6.20.1 kernel

These build instructions are for the generic_kernel_586+ package, which is intended as a quick-start demonstration, not production use. You should treat these instructions merely as a starting point for building your own custom kernel, which you should install to ~/diet-pc/kernel, or some other directory containing the word "kernel" that is distinct from ~/diet-pc/generic_kernel_586+.

tar xjf ~/diet-pc-src/linux-2.6.20.tar.bz2
mv linux-2.6.20 linux-2.6.20.1
cd linux-2.6.20.1
bunzip2 -c ~/diet-pc-src/patch-2.6.20.1.bz2 | patch -p1 -E
gunzip -c ~/diet-pc-src/linux-2.6.20-u1.diff.gz | patch -p1 -E
bunzip2 -c ~/diet-pc-src/linux-2.6.19-squashfs2.2-patch.bz2 | patch -p1 -E
bunzip2 -c ~/diet-pc-src/bootsplash-3.1.6-2.6.18.diff.bz2 | patch -p1 -E
# (PPC, ARM and MIPSEL: don't apply this patch, bootsplash doesn't work on
# non-x86 hardware because it doesn't support VESA)
vi ./drivers/video/bootsplash/{render,bootsplash,decode-jpg}.c
#	Delete "#include <linux/config.h>"
cp ~/diet-pc-src/config.generic_586+ .config	# or any other kernel config
						# file that you wish to use as
						# an initial template
make menuconfig				# Modify as necessary, then save and
					# exit.  If your config template comes
					# from an older kernel, pay close
					# attention to items marked "(NEW)".
make bzImage ROOT_DEV=''
# (ARM: zImage instead of bzImage)
# (PPC: vmlinux instead of bzImage)
mkdir -p ~/diet-pc/generic_kernel_586+
cp .config ~/diet-pc/generic_kernel_586+/config.generic_586+/
cp System.map ~/diet-pc/generic_kernel_586+/
cp arch/i386/boot/bzImage ~/diet-pc/generic_kernel_586+/
# (x86_64: copy arch/x86_64/boot/zImage instead of arch/i386/boot/bzImage)
# (ARM: copy arch/arm/boot/zImage instead of arch/i386/boot/bzImage)
# (PPC: copy vmlinux instead of arch/i386/boot/bzImage)
make modules
make modules_install INSTALL_MOD_PATH=~/diet-pc/generic_kernel_586+/files
ln -s `pwd`/include ~/diet-pc/generic_kernel_586+/include
cd ..
# Leave the kernel tree intact - it will be needed to build out-of-tree modules.

libfame 0.9.1

LibFAME is a prerequisite for xine-lib.

On an x86 platform, you will get a missing MMX symbol at runtime if you compile using gcc 4.x, so use an older compiler instead. On non-x86 architectures you can probably get away with using gcc 4.x, although there will be some (harmless?) configure script errors.

FIXME: won't compile for x86_64.

FIXME: do we really need this? Apprently it's only used by the (rarely needed) xineplug_vo_out_dxr3 driver.

tar xzf ~/diet-pc-src/libfame-0.9.1.tar.gz
cd libfame-0.9.1
CC=gcc-2.95 CFLAGS=-O3 ./configure --enable-sse --build=i386-dietpc-linux-gnu
# (PPC/ARM: CC=gcc-2.95 CFLAGS=-O3 ./configure --disable-mmx)
make
sudo make install
cd ..
rm -rf libfame-0.9.1

lm_sensors 2.10.5

Prerequisite: you must compile and install the rrdtool and libsysfs (sysfsutils) libraries first.

These instructions only are only for compiling user-space tools. Compiling kernel modules is your problem :-).

tar xzf ~/diet-pc-src/lm_sensors-2.10.5.tar.gz
cd lm_sensors-2.10.5
make user PROG_EXTRA=sensord CFLAGS="$CFLAGS"
gcc -shared -Wl,-soname,libsensors.so.3 -o lib/libsensors.so.3 lib/*.lo \
	-Wl,-Bstatic -lsysfs -Wl,-Bdynamic -lm
strip -R .note -R .comment prog/sensors/sensors prog/sensord/sensord \
	lib/libsensors.so.3
mkdir -p ~/diet-pc/sensors/files/etc
mkdir -p ~/diet-pc/sensors/files/usr/{bin,lib,sbin}
cp etc/sensors.conf.eg ~/diet-pc/sensors/files/etc/sensors.conf
cp prog/sensors/sensors ~/diet-pc/sensors/files/usr/bin/
cp prog/sensord/sensord ~/diet-pc/sensors/files/usr/sbin/
cp lib/libsensors.so.3 ~/diet-pc/sensors/files/usr/lib/
~/diet-pc/tools/man2txt prog/sensors/sensors.1 >\
	~/diet-pc/sensors/sensors.txt
~/diet-pc/tools/man2txt prog/sensord/sensord.8 >\
	~/diet-pc/sensors/sensord.txt
cd ..
rm -rf lm_sensors-2.10.5

lp_server 1.6

lp_server was originally an LprNG contrib, but apparently can now only be found on the LTSP project's downloads page.

You may wish to consider using p910nd instead.

tar xzf ~/diet-pc-src/lp_server-1.1.6.tar.gz
cd lp_server-1.1.6
gunzip -c ~/diet-pc-src/lp_server-1.1.6-dietpc.patch.gz | patch -p1 -b
./configure --prefix=/usr
make LDFLAGS='-lwrap'
strip -R .note -R .comment src/lp_server
mkdir -p ~/diet-pc/shell/files/usr/sbin
cp src/lp_server ~/diet-pc/shell/files/usr/sbin/
~/diet-pc/tools/man2txt man/lp_server.8 >~/diet-pc/shell/lp_server.txt
cd ..
rm -rf lp_server-1.1.6

mac-fdisk 0.1-14 (a.k.a. pdisk 0.4a2)

mac-disk is specific to the PowerPC port of DIET-PC. It is maintained by the Debian distribution (http://packages.debian.org/stable/source/mac-fdisk/).

tar xzf ~/diet-pc-src/mac-fdisk_0.1.orig.tar.gz
cd mac-fdisk-0.1.orig
gunzip -c ~/diet-pc-src/mac-fdisk_0.1-14.diff.gz | patch -p1 -b
make
strip -R .note -R .comment pdisk
mkdir -p ~/diet-pc/assembler_installer/files/sbin
cp pdisk ~/diet-pc/assembler_installer/files/sbin/mac-fdisk
~/diet-pc/tools/man2txt mac-fdisk.8.in \
	>~/diet-pc/assembler_installer/mac-fdisk.txt
cd ..
rm -rf mac-fdisk-0.1.orig

make 3.81

tar xjf ~/diet-pc-src/make-3.81.tar.bz2
cd make-3.81
./configure --prefix=/usr --disable-nls
vi Makefile	# change "LIBS = -Wl,-Bstatic -lrt -Wl,-Bdynamic"
		# on x86_64, this trick won't work, so don't bother - you will
		# have to add librt.so.1 to assembler_installer/files/lib
		# or shell/files/lib
make
strip -R .note -R .comment make
mkdir -p ~/diet-pc/assembler_installer/files/usr/bin
cp make ~/diet-pc/assembler_installer/files/usr/bin/
cd ..
rm -rf make-3.81

module-init-tools 3.2.2

Not on Freshmeat at present, for some reason. You can find it on kernel.org and its mirrors, at more-or-less the same location as modutils.

tar xjf ~/diet-pc-src/module-init-tools-3.2.2.tar.bz2
cd module-init-tools-3.2.2
bunzip2 -c ~/diet-pc-src/module-init-tools-3.2-dietpc-patch.bz2 | patch -p1 -b
./configure --prefix='' --enable-zlib
make
strip -R .note -R .comment depmod insmod lsmod modinfo modprobe rmmod
mkdir -p ~/diet-pc/shell/files/sbin
cp depmod insmod lsmod modinfo modprobe rmmod ~/diet-pc/shell/files/sbin/
cd ..
rm -rf module-init-tools-3.2.2

modutils 2.4.27

These instructions are for DIET-PC 2. For 1.1, you should omit the ".old" suffices when installing the binaries.

tar xjf ~/diet-pc-src/modutils-2.4.27.tar.bz2
cd modutils-2.4.27
# For GCC 4.x, you'll need to work around some sloppy coding using this patch:
#bunzip2 -c ~/diet-pc-src/modutils-2.4.27-gcc4-patch.bz2 | patch -p1 -b
./configure --enable-combined --disable-combined-ksyms \
	--disable-combined-kallsyms --disable-compat-2-0 \
	--disable-common-i386 --enable-zlib --with-dynamic-zlib
make
strip -R .note -R .comment depmod/depmod insmod/insmod insmod/modinfo
mkdir -p ~/diet-pc/shell/files/sbin
cp depmod/depmod ~/diet-pc/shell/files/sbin/depmod.old
cp insmod/insmod ~/diet-pc/shell/files/sbin/insmod.old
cp insmod/modinfo ~/diet-pc/shell/files/sbin/modinfo.old
ln -s insmod.old ~/diet-pc/shell/files/sbin/lsmod.old
ln -s insmod.old ~/diet-pc/shell/files/sbin/modprobe.old
ln -s insmod.old ~/diet-pc/shell/files/sbin/rmmod.old
cd ..
rm -rf modutils-2.4.27

mtools 3.9.11 (20071226)

tar xjf ~/diet-pc-src/mtools-3.9.11.tar.bz2
cd mtools-3.9.11
gunzip -c ~/diet-pc-src/mtools-3.9.11-20071226.diff.gz | patch -p1 -b
bunzip2 -c ~/diet-pc-src/mtools-3.9.9-dietpc-patch.bz2 | patch -p1 -b
./configure --prefix=/usr/X11R6 --sysconfdir=/etc --enable-floppyd
make floppyd
gcc -o floppyd floppyd.o -L/usr/X11R6/lib -lX11 -lwrap
strip -R .note -R .comment floppyd
mkdir -p ~/diet-pc/storageserver/files/usr/X11R6/bin
cp floppyd ~/diet-pc/storageserver/files/usr/X11R6/bin/
~/diet-pc/tools/man2txt floppyd.1 >~/diet-pc/storageserver/floppyd.txt
cd ..
rm -rf mtools-3.9.11

NAS 1.9.1

This suite of programs leverages X11 libraries and build automation. You need at least xutils-dev, libxt-dev, libxaw7-dev, and all of their dependencies in order to compile it.

tar xzf ~/diet-pc-src/nas-1.9.1.src.tar.gz
cd nas-1.9.1
xmkmf
make World CDEBUGFLAGS="$CFLAGS -fno-strict-aliasing"
strip -R .note -R .comment server/nasd
mkdir -p ~/diet-pc/shell/files/usr/sbin
cp server/nasd ~/diet-pc/shell/files/usr/sbin/
~/diet-pc/tools/man2txt server/nasd.man >~/diet-pc/shell/nasd.txt
~/diet-pc/tools/man2txt server/nasd.conf.man >\
	~/diet-pc/shell/nasd.conf.txt
cd ..
rm -rf nas-1.9.1

nbd 1.4

We use this obsolete version of nbd because it creates a much smaller nbd-server binary. Newer versions add features that we don't need, and link against very large libraries mostly for programmer convenience.

The distribution can be downloaded from the legacy NBD page.

tar xzf ~/diet-pc-src/nbd.14.tar.gz
cd nbd
./configure --prefix=/usr --sysconfdir=/etc
vi nbd-server.c		# Comment out definition and undefinition of _IO macro
			# (lines 28, 32), change llseek to lseek64 (line 162)
make
strip -R .note -R .comment nbd-server
mkdir -p ~/diet-pc/storageserver/files/usr/sbin
cp nbd-server ~/diet-pc/storageserver/files/usr/sbin/
cd ..
rm -rf nbd

nbd 2.9.9

We use nbd-client from this version, because it contains significant bug fixes and feature additions compared with version 1.4, at negligible size cost.

This (up-to-date) version of nbd can be found at http://nbd.sourceforge.net.

tar xjf ~/diet-pc-src/nbd-2.9.9.tar.bz2
cd nbd-2.9.9
./configure --prefix=/usr --sysconfdir=/etc --enable-syslog
make nbd_server_LDADD='-Wl,-Bstatic -lglib-2.0 -Wl,-Bdynamic'
strip -R .note -R .comment nbd-client
mkdir -p ~/diet-pc/shell/files/sbin
cp nbd-client ~/diet-pc/shell/files/sbin/
~/diet-pc/tools/man2txt nbd-client.8 >~/diet-pc/shell/nbd-client.txt
cd ..
rm -rf nbd-2.9.9

netboot 0.10.2

netboot is specific to the x86 and x86_64 ports of DIET-PC.

tar xzf ~/diet-pc-src/netboot-0.10.2.tar.gz
cd netboot-0.10.2
./configure --prefix=/usr --sysconfdir=/etc --without-berkeley-db \
	--disable-shared
make
strip -R .note -R .comment mknbi-linux/mknbi
mkdir -p ~/diet-pc/tools ~/diet-pc/tools-doc
cp mknbi-linux/mknbi ~/diet-pc/tools/mknbi-linux
~/diet-pc/tools/man2txt mknbi-linux/mknbi.man >\
	~/diet-pc/tools-doc/mknbi-linux.txt
cd ..
rm -rf netboot-0.10.2

ntpclient 2003_194

Ntpclient's home page is http://doolittle.icarus.com/ntpclient/.

tar xzf ~/diet-pc-src/ntpclient_2003_194.tar.gz
cd ntpclient
make
strip -R .note -R .comment ntpclient
mkdir -p ~/diet-pc/shell/files/usr/sbin
cp ntpclient ~/diet-pc/shell/files/usr/sbin/
cd ..
rm -rf ntpclient

numlock 2.0

This utility is from the Mandrake Linux distribution. Source code can be found via rpmfind.net.

rpm2cpio ~/diet-pc-src/numlock-2.0-18mdv2008.0.src.rpm | cpio -i \
	numlock-2.0.tar.bz2
tar xjf numlock-2.0.tar.bz2
cd numlock-2.0
gcc -c $CFLAGS -Wall -I/usr/X11R6/include enable_X11_numlock.c
gcc -o enable_X11_numlock enable_X11_numlock.o -L/usr/X11R6/lib -lX11 -lXext \
	-Wl,-Bstatic -lXtst -Wl,-Bdynamic
strip -R .note -R .comment enable_X11_numlock
mkdir -p ~/diet-pc/xcore/files/usr/X11R6/bin
cp enable_X11_numlock ~/diet-pc/xcore/files/usr/X11R6/bin/
cd ..
rm -rf numlock-2.0 numlock-2.0.tar.bz2

openchrome SVN

OpenChrome is a video driver for Via embedded chipsets that is more capable and supports newer hardware than the Unichrome driver bundled with Xorg. I use this because I happen to have one of these newer chipsets (CN700). Use of this driver is entirely optional (if you don't use it, your xserver_xorg_via package will be built using the bundled Xorg driver instead).

This driver will need access to your Xorg (xc) tree, so build Xorg first (and don't clean up afterwards).

svn co http://svn.openchrome.org/svn/trunk openchrome
cd openchrome
bunzip2 -c ~/diet-pc-src/via_vt1625_PAL.diff.bz2 | patch -p1 -b
	# This is David Vidrie's patch, as advertised on the openchrome-users
	# mailing list in December 2005, available at
	# http://hal9000.eui.upm.es/~loko/openchrome/via_vt1625_PAL.diff.
	# Why it hasn't been committed to SVN yet is a mystery!
cd libxvmc
xmkmf ~/xc	# Or wherever your Xorg build tree is located.
make
strip -R .note -R .comment libviaXvMC.so.1 libviaXvMCPro.so.1
mkdir -p ~/diet-pc/xserver_xorg_via/files/usr/X11R6/lib
cp libviaXvMC.so.1 libviaXvMCPro.so.1 \
	~/diet-pc/xserver_xorg_via/files/usr/X11R6/lib/
cd ../unichrome
xmkmf ~/xc	# Or wherever your Xorg build tree is located.
make
strip -R .note -R .comment via_drv.so
mkdir -p ~/diet-pc/xserver_xorg_via/files/usr/X11R6/lib/modules/drivers
cp via_drv.so ~/diet-pc/xserver_xorg_via/files/usr/X11R6/lib/modules/drivers/
~/diet-pc/tools/man2txt via._man >~/diet-pc/xserver_xorg_via/via.txt
cd ../..
rm -rf openchrome

openmotif 2.2.4

OpenMotif is a (regrettable) necessity for the wfcmgr component of ICA Client version 9.0 and later. There is no ICA Client 9 available for PowerPC or ARM Linux, so at present there is no point in compiling OpenMotif for these architectures.

OpenMotif's official homepage is very outdated. For all intents and purposes, the real home page is actually http://www.motifzone.com/. OpenMotif is shunned by many Linux distros because of its license restrictions, but at present it is the only free implementation that provides the full Motif 2.0 compliance that Linux ICA Client 9 needs.

OpenMotif 2.2.4 contains important security fixes, but there isn't a generic official source tarball, so we'll have to extract it from one of the distro-specific SRPMs instead.

rpm2cpio ~/diet-pc-src/openmotif-2.2.4-0.1.src.rpm | cpio -i \
        openmotif-2.2.4.tar.gz
tar xzf openmotif-2.2.4.tar.gz
cd openmotif-2.2.4
amvers=`automake --version | awk '{print $NF; exit}'`
# OpenMotif 2.3:
#for amfile in compile config.guess config.sub depcomp install-sh missing \
#	mkinstalldirs; do
for amfile in missing mkinstalldirs depcomp install-sh; do
    rm $amfile
    ln -s /usr/share/automake-$amvers/$amfile
done
# OpenMotif 2.3:
#rm -f ltmain.sh
#ln -s /usr/share/libtool/ltmain.sh
#vi lib/Xm/Xm.h.in	# uncomment commented out inclusion of
#			# <X11/extensions/Print.h>
#./configure --prefix=/usr/X11R6 --sysconfdir=/etc/X11 --disable-static \
#	--disable-utf8 --disable-xft --disable-png --disable-jpeg
./configure --prefix=/usr/X11R6 --disable-static
make -C lib/Xm
strip -R .note -R .comment lib/Xm/.libs/libXm.so.3
mkdir -p ~/diet-pc/ica/extras
cp lib/Xm/.libs/libXm.so.3 ~/diet-pc/ica/extras/
cd ..
rm -rf openmotif-2.2.4 openmotif-2.2.4.tar.gz

openssh 4.7p1

tar xzf ~/diet-pc-src/openssh-4.7p1.tar.gz
cd openssh-4.7p1
./configure --prefix=/usr --sysconfdir=/etc --with-tcp-wrappers \
	--disable-wtmp --disable-lastlog --with-ssl-dir=/usr/local \
	--with-md5-passwords --with-ipaddr-display --with-ipv4-default \
	--build=i386-dietpc-linux-gnu
# Or "--with-ssl-dir=/usr" to use your host's OpenSSL libraries, if you prefer.
# (x86_64: use --build=x86_64-dietpc-linux-gnu)
# (PPC: use --build=powerpc-dietpc-linux-gnu)
# (ARM: use --build=arm-dietpc-linux-gnu)
# (MIPSEL: use --build=mipsel-dietpc-linux-gnu)
make
rm -f ssh scp ssh-keygen
# Note to self: for opensc support, also need to add "-lopensc -lopenct
# -lscconf -lltdl" to the list of statically linked libs, and -lpcsclite to
# dynamically linked libs, for ssh and ssh-keygen (adds ~450k to file size)
make ssh ssh-keygen \
	LIBS='-lresolv -ldl -lz -L/usr/local/lib -Wl,-Bstatic -lcrypto -Wl,-Bdynamic'
make scp LIBS='-lresolv -L/usr/local/lib -Wl,-Bstatic -lcrypto -Wl,-Bdynamic'
strip -R .note -R .comment ssh scp ssh-keygen
mkdir -p ~/diet-pc/ssh/files/usr/bin ~/diet-pc/ssh/files/etc
mkdir -p ~/diet-pc/ssh/extras
cp moduli ~/diet-pc/ssh/files/etc/
cp ssh scp ~/diet-pc/ssh/files/usr/bin/
chmod 4755 ~/diet-pc/ssh/files/usr/bin/ssh
ln -s ssh ~/diet-pc/ssh/files/usr/bin/slogin
cp ssh-keygen ~/diet-pc/ssh/extras/
~/diet-pc/tools/man2txt scp.1 >~/diet-pc/ssh/scp.txt
~/diet-pc/tools/man2txt ssh.1 >~/diet-pc/ssh/ssh.txt
~/diet-pc/tools/man2txt ssh_config.5 >~/diet-pc/ssh/ssh_config.txt
~/diet-pc/tools/man2txt ssh-keygen.1 >~/diet-pc/ssh/extras/ssh-keygen.txt
cd ..
rm -rf openssh-4.7p1

openssl 0.9.7m

Your host platform no doubt provides OpenSSL libraries that you can link against. However, there are some advantages in building a custom version. Firstly, OpenSSL 0.9.7 is significantly smaller than OpenSSL 0.9.8. Secondly, this version may be more up-to-date with regard to security fixes than your host's. And thirdly, unlike your host's libraries, these will actually run on an 80386 (because we remove "-m486").

This library isn't installed in DIET-PC directly, but it is linked against by OpenSSH and Rdesktop. Optimisation is important for this library, so we will tolerate the space demands of "-O3".

tar xzf ~/diet-pc-src/openssl-0.9.7m.tar.gz
cd openssl-0.9.7m
vi Configure	# Remove -m486 from "linux-elf" section (x86 only)
./config --prefix=/usr/local --openssldir=/usr/local/openssl no-shared 386
# (x86_64/PPC/ARM/MIPSEL: omit "386")
make
sudo make install
cd ..
rm -rf openssl-0.9.7m

pciutils 2.2.9

The authoritative site for the pcimodules patch (ftp://ftp.yggdrasil.com/pub/dist/device_control/pcimodules) seems to be permanently unreachable, and copies can be difficult to locate. I have updated the original patch (for pciutils 2.1.11) for pciutils 2.2.6; this patch is available from the DIET-PC downloads area.

tar xjf ~/diet-pc-src/pciutils-2.2.9.tar.bz2
cd pciutils-2.2.9
bunzip2 -c ~/diet-pc-src/pciutils-2.2.6-pcimodules-1.patch.bz2 | patch -p1 -b
vi Makefile	# change PREFIX=/usr, OPT=$CFLAGS
make
strip -R .note -R .comment pcimodules lspci
mkdir -p ~/diet-pc/shell/files/sbin
mkdir -p ~/diet-pc/shell/extras
cp pcimodules ~/diet-pc/shell/files/sbin/
cp lspci pci.ids.gz ~/diet-pc/shell/extras/
~/diet-pc/tools/man2txt lspci.8 >~/diet-pc/shell/extras/lspci.txt
cd ..
rm -rf pciutils-2.2.9

pmac-utils 2.1

pmac-utils is specific to the PowerPC port of DIET-PC. It is part of the Yellow Dog Linux distribution, and is available from ftp://ftp.yellowdoglinux.com/pub/yellowdog/releases/yellowdog-5.0/en/os/SRPMS/ .

rpm2cpio ~/diet-pc-src/pmac-utils-2.1-5.ydl.3.src.rpm | cpio -i \
	pmac-utils-2.1.tar.gz
tar xzf pmac-utils-2.1.tar.gz
cd pmac-utils-2.1
vi Makefile	# Removed "-g -O2" from CFLAGS, add $CFLAGS
# N.B. you'll need linuxdoc-tools and its various tetex dependencies installed
# in order for sgml2txt to work.
make
strip -R .note -R .comment nvsetenv
mkdir -p ~/diet-pc/assembler_installer/files/sbin
cp nvsetenv ~/diet-pc/assembler_installer/files/sbin/
~/diet-pc/tools/man2txt nvsetenv.8 \
	>~/diet-pc/assembler_installer/nvsetenv.txt
cd ..
rm -rf pmac-utils-2.1

portmap 6.0

tar xzf ~/diet-pc-src/portmap-6.0.tgz
cd portmap_6.0
vi Makefile	# Substitute FACILITY=LOG_AUTHPRIV
vi pmap_check.[ch]	# Remove '__attribute ((visibility ("hidden")))' from
			# declarations of verboselog, deny_severity and
			# allow_severity (such that they are just simple
			# integers)
make
strip -R .note -R .comment portmap
mkdir -p ~/diet-pc/remotefs/files/sbin
cp portmap ~/diet-pc/remotefs/files/sbin/
cd ..
rm -rf portmap_6.0

rdesktop 1.5.0

tar xzf ~/diet-pc-src/rdesktop-1.5.0.tar.gz
cd rdesktop-1.5.0
bunzip2 -c ~/diet-pc-src/rdesktop-1.5.0-dietpc-patch.bz2 | patch -p1 -b
./configure --prefix=/usr/X11R6 --with-openssl=/usr/local --with-sound
# Or "--with-openssl=/usr" if you want to use your platform's native libraries.
vi Makefile	# LDFLAGS = -L/usr/lib -Wl,-Bstatic -lcrypto -Wl,-Bdynamic
make
strip -R .note -R .comment rdesktop
mkdir -p ~/diet-pc/rdp/files/usr/X11R6/bin ~/diet-pc/rdp/extras
mkdir -p ~/diet-pc/rdp/files/usr/X11R6/share/rdesktop/keymaps
cp rdesktop ~/diet-pc/rdp/files/usr/X11R6/bin/
cp keymaps/{common,modifiers,en-us} \
	~/diet-pc/rdp/files/usr/X11R6/share/rdesktop/keymaps/
	# or substitute the appropriate keymap for your locale for "en-us"
cp -r keymaps ~/diet-pc/rdp/extras/
rm -rf ~/diet-pc/rdp/extras/keymaps/{common,modifiers,convert-map}
~/diet-pc/tools/man2txt doc/rdesktop.1 >~/diet-pc/rdp/rdesktop.txt
cd ..
rm -rf rdesktop-1.5.0

replimenu 0.9

tar xzf ~/diet-pc-src/replimenu-0.9.tar.gz
cd replimenu-0.9
vi configuration	# change "CFLAGS=-Wall -Wshadow $CFLAGS", "PREFIX=/usr"
make
strip -R .note -R .comment src/replimenu
mkdir -p ~/diet-pc/shell/files/usr/bin
cp src/replimenu ~/diet-pc/shell/files/usr/bin/
~/diet-pc/tools/man2txt man/replimenu.1 >~/diet-pc/shell/replimenu.txt
cd ..
rm -rf replimenu-0.9

rfb 0.6.1.1

This code is no longer supported, but still provides better functionality than supported alternatives (eg. RealVNC's x0vncserver). The source code can be found at http://xclass.sourceforge.net/.

The xclass library is a prerequisite for rfb.

To avoid a huge binary, you should compile this with the oldest version of g++/gcc available on your platform.

tar xzf ~/diet-pc-src/rfb-0.6.1.1.tar.gz
cd rfb-0.6.1.1
bunzip2 -c ~/diet-pc-src/rfb-0.6.1.1-dietpc-patch.bz2 | patch -p1 -b
vi {lib,x0rfbserver}/Makefile	# substitute $CXXFLAGS for "-O3" in CXXFLAGS
cd lib
make CXX=g++-2.95
cd ../x0rfbserver
vi +501 x0rfbserver.cc		# Change "size_t" to "socklen_t"
make CXX=g++-2.95		# this will probably fail, but don't worry
gcc-2.95 -o x0rfbserver *.o ../lib/librfb.a -lz -lm -L/usr/X11R6/lib \
	-L/usr/local/lib -lXext -lX11 -lXpm -Wl,-Bstatic -lxclass -lXtst \
	-lstdc++ -Wl,-Bdynamic -lwrap	# For gcc3 or later add -static-libgcc
strip -R .note -R .comment x0rfbserver
mkdir -p ~/diet-pc/rfbserver/files/usr/X11R6/bin
cp x0rfbserver ~/diet-pc/rfbserver/files/usr/X11R6/bin/
cd ../..
rm -rf rfb-0.6.1.1

rrdtool 1.0.50

A prerequisite for lm_sensors. We specifically want the obsolete 1.0.x version because it's smaller. It's very unlikely that this is available for your platform.

tar xzf ~/diet-pc-src/rrdtool-1.0.50.tar.gz
cd rrdtool-1.0.50
./configure --prefix=/usr/local --sysconfdir=/etc
make
sudo make install
cd ..
rm -rf rrdtool-1.0.50

rrshd 1.1.1

tar xzf ~/diet-pc-src/rrshd-1.1.1.tar.gz
cd rrshd
vi Makefile	# substitute $CFLAGS for "-O2" in CFLAGS
make
strip -R .note -R .comment in.rrshd
mkdir -p ~/diet-pc/shell/files/usr/sbin
cp in.rrshd ~/diet-pc/shell/files/usr/sbin/
cd ..
rm -rf rrshd

rxvt 2.7.10

tar xzf ~/diet-pc-src/rxvt-2.7.10.tar.gz
cd rxvt-2.7.10
./configure --prefix=/usr/X11R6 --enable-xterm-scroll --enable-xgetdefault \
	--enable-mousewheel --enable-smart-resize --enable-256-color \
	--enable-24bit --disable-backspace-key --disable-delete-key
vi +1325 src/command.c	# Change type of "upordown" to "signed char"
make
strip -R .note -R .comment src/rxvt
mkdir -p ~/diet-pc/xcore/extras
cp src/rxvt ~/diet-pc/xcore/extras/
cd ..
rm -rf rxvt-2.7.10

samba 1.9.18p10

tar xzf ~/diet-pc-src/samba-1.9.18p10.tar.gz
cd samba-1.9.18p10
bunzip2 -c ~/diet-pc-src/samba-1.9.18p8-dietpc-patch.bz2 | patch -p1 -b
cd source
vi Makefile	# Change "FLAGS1=$CFLAGS -DSYSLOG"
make
strip -R .note -R .comment smbd nmbd smbpasswd
mkdir -p ~/diet-pc/smbserver/files/usr/sbin
cp smbd nmbd ~/diet-pc/smbserver/files/usr/sbin/
mkdir -p ~/diet-pc/smbserver/extras/codepages
for page in 437 737 850 852 861 932 866 949 950 936; do
	./make_smbcodepage c $page codepage_def.$page \
		~/diet-pc/smbserver/extras/codepages/codepage.$page
done
mkdir -p ~/diet-pc/smbserver/files/usr/lib/codepages
cp ~/diet-pc/smbserver/extras/codepages/codepage.850 \
	~/diet-pc/smbserver/files/usr/lib/codepages/
cp smbpasswd ~/diet-pc/smbserver/extras/
cd ..
~/diet-pc/tools/man2txt docs/smbd.8 >~/diet-pc/smbserver/smbd.txt
~/diet-pc/tools/man2txt docs/nmbd.8 >~/diet-pc/smbserver/nmbd.txt
~/diet-pc/tools/man2txt docs/smb.conf.5 >~/diet-pc/smbserver/smb.conf.txt
cd ..
rm -rf samba-1.9.18p10

samba 3.0.28

tar xzf ~/diet-pc-src/samba-3.0.28.tar.gz
cd samba-3.0.28/source
./configure --prefix=/usr --with-configdir=/etc --with-privatedir=/etc \
	--with-lockdir=/var/lock --with-piddir=/var/run \
	--with-logfilebase=/var/log --with-syslog --without-readline \
	--disable-cups --with-included-popt --without-ldap --without-ads \
	--with-smbmount
vi include/config.h	# Comment out "#define HAVE_POSIX_CAPABILITIES 1", if
			# set
make bin/libsmbclient.a
make bin/smbmnt
make bin/smbmount LIBS='-ldl -lnsl -lresolv'
gcc -o bin/mount.cifs $CFLAGS client/mount.cifs.c
strip -R .note -R .comment bin/smb{mnt,mount} bin/mount.cifs
mkdir -p ~/diet-pc/remotefs/files/sbin ~/diet-pc/remotefs/files/usr/bin
cp bin/mount.cifs ~/diet-pc/remotefs/files/sbin/
cp bin/smb{mnt,mount} ~/diet-pc/remotefs/files/usr/bin/
ln -s ../usr/bin/smbmount ~/diet-pc/remotefs/files/sbin/mount.smbfs
cd ..
~/diet-pc/tools/man2txt docs/manpages/smbmnt.8 \
	>~/diet-pc/remotefs/smbmnt.txt
~/diet-pc/tools/man2txt docs/manpages/smbmount.8 \
	>~/diet-pc/remotefs/smbmount.txt
~/diet-pc/tools/man2txt docs/manpages/mount.cifs.8 \
	>~/diet-pc/remotefs/mount.cifs.txt
cd ..
rm -rf samba-3.0.28

squashfs 2.2-r2

Version 2.2 is very outdated, but DIET-PC 2 must continue to use this, because SquashFS 3.x is not backward compatible with 2.x, and the skeleton package (which includes mksquashfs) must remain interoperable with the earliest DIET-PC 2.0 kernel, which used SquashFS 2.0.

tar xzf ~/diet-pc-src/squashfs2.2-r2.tar.gz
cd squashfs2.2-r2/squashfs-tools
vi Makefile	# Substitute $CFLAGS for "-g" in CFLAGS
make
strip -R .note -R .comment mksquashfs
mkdir -p ~/diet-pc/tools
cp mksquashfs ~/diet-pc/tools/mksquashfs2
ln -s mksquashfs2 ~/diet-pc/tools/mksquashfs
cd ../..
rm -rf squashfs2.2-r2

squashfs 3.3

This is the newer version of SquashFS, not compatible with SquashFS 2.2, and not used by default. If you want to use SquashFS 3.x, change the ~/diet-pc/tools/mksquashfs symlink to point to mksquashfs3 instead of mksquashfs2.

tar xzf ~/diet-pc-src/squashfs3.3.tgz
cd squashfs3.3/squashfs-tools
vi Makefile	# Substitute $CFLAGS for "-O2" in CFLAGS
make
strip -R .note -R .comment mksquashfs
mkdir -p ~/diet-pc/tools
cp mksquashfs ~/diet-pc/tools/mksquashfs3
cd ../..
rm -rf squashfs3.3

startsess 1.1

startsess is from the LTSP project.

(FIXME: deprecation warning here.)

tar xjf ~/diet-pc-src/startsess-1.1.tar.bz2
cd startsess-1.1
gcc $CFLAGS -o startsess startsess.c
strip -R .note -R .comment startsess
mkdir -p ~/diet-pc/shell/files/sbin
mv startsess ~/diet-pc/shell/files/sbin/

strace 4.5.16

tar xjf ~/diet-pc-src/strace-4.5.16.tar.bz2
cd strace-4.5.16
./configure --prefix=/usr --sysconfdir=/etc
make
strip -R .note -R .comment strace
mkdir -p ~/diet-pc/shell/extras
cp strace ~/diet-pc/shell/extras/
cd ..
rm -rf strace-4.5.16

sysfsutils 2.1.0

sysfsutils is part of the linux-diag project, available from http://linux-diag.sourceforge.net/Sysfsutils.html. It is a prerequisite for compiling sensord in the lm_sensors distribution.

On Debian (other than amd64), try "apt-get install libsysfs-dev" instead. On Debian amd64, you will need to compile and install your own libsysfs with the "-fPIC" option as below, because you can't safely link a dynamic library against a non-PIC static library on an x86_64 platform.

tar xzf ~/diet-pc-src/sysfsutils-2.1.0.tar.gz
cd sysfsutils-2.1.0
CFLAGS="$CFLAGS -fPIC" ./configure --prefix=/usr/local --disable-shared
make
sudo make install
cd ..
rm -rf sysfsutils-2.1.0

syslinux 3.54

syslinux is specific to the x86 and x86_64 ports of DIET-PC.

You will need to install netpbm in order to avoid build errors (pngtopnm is needed).

tar xjf ~/diet-pc-src/syslinux-3.54.tar.bz2
cd syslinux-3.54
make clean
make
strip -R .note -R .comment unix/syslinux extlinux/extlinux
mkdir -p ~/diet-pc/tools ~/diet-pc/tools-doc
mkdir -p ~/diet-pc/templates/mbr
mkdir -p ~/diet-pc/templates/extlinux/boot/extlinux
mkdir -p ~/diet-pc/templates/isolinux/boot/isolinux
mkdir -p ~/diet-pc/templates/pxelinux/pxelinux
mkdir -p ~/diet-pc/templates/syslinux/boot/syslinux
cp sha1pass unix/syslinux extlinux/extlinux ~/diet-pc/tools/
cp extlinux.doc ~/diet-pc/tools-doc/extlinux.txt
cp isolinux.doc ~/diet-pc/tools-doc/isolinux.txt
cp pxelinux.doc ~/diet-pc/tools-doc/pxelinux.txt
cp syslinux.doc ~/diet-pc/tools-doc/syslinux.txt
cp mbr/mbr.bin ~/diet-pc/templates/mbr/
cp isolinux.bin ~/diet-pc/templates/isolinux/boot/isolinux/
cp pxelinux.0 ~/diet-pc/templates/pxelinux/pxelinux/
cp com32/modules/{menu,vesamenu,chain}.c32 \
	~/diet-pc/templates/extlinux/boot/extlinux/
cp com32/modules/{menu,vesamenu,chain}.c32 \
	~/diet-pc/templates/isolinux/boot/isolinux/
cp com32/modules/{menu,vesamenu,chain}.c32 \
	~/diet-pc/templates/pxelinux/pxelinux/
cp com32/modules/{menu,vesamenu,chain}.c32 \
	~/diet-pc/templates/syslinux/boot/syslinux/
cd ..
rm -rf syslinux-3.54

sysvinit 2.86

tar xzf ~/diet-pc-src/sysvinit-2.86.tar.gz
cd sysvinit-2.86
bunzip2 -c ~/diet-pc-src/sysvinit-2.86-dietpc-patch.bz2 | patch -p1 -b
cd src
make CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE"
strip -R .note -R .comment init halt
mkdir -p ~/diet-pc/shell/files/sbin
cp init halt ~/diet-pc/shell/files/sbin/
ln -s sbin/init ~/diet-pc/shell/files/init
ln -s halt ~/diet-pc/shell/files/sbin/reboot
cd ../..
rm -rf sysvinit-2.86

tcp_wrappers 7.6-ipv6.4

tar xzf ~/diet-pc-src/tcp_wrappers_7.6-ipv6.4.tar.gz
cd tcp_wrappers_7.6-ipv6.4
chmod u+w Makefile
vi Makefile	# set REAL_DAEMON_DIR=/usr/sbin, STYLE=-DPROCESS_OPTIONS,
		# FACILITY=LOG_AUTH; in linux section add VSYSLOG=, change
		# AUX_OBJ=, EXTRA_CFLAGS="$CFLAGS -fPIC -DUSE_STRERROR",
		# comment out VSYSLOG
make linux
gcc -shared -o libwrap.so.0 -Wl,-soname=libwrap.so.0 hosts_access.o options.o \
	shell_cmd.o rfc931.o eval.o hosts_ctl.o refuse.o percent_x.o \
	clean_exit.o fromhost.o fix_options.o socket.o tli.o workarounds.o \
	update.o misc.o diag.o percent_m.o myvsyslog.o
strip -R .note -R .comment libwrap.so.0
mkdir -p ~/diet-pc/shell/files/lib
cp libwrap.so.0 ~/diet-pc/shell/files/lib/
ln -s libwrap.so.0 ~/diet-pc/shell/files/lib/libwrap.so
~/diet-pc/tools/man2txt hosts_access.5 >~/diet-pc/shell/hosts_access.txt
cd ..
rm -rf tcp_wrappers_7.6-ipv6.4

tightvnc 1.3.9

tar xjf ~/diet-pc-src/tightvnc-1.3.9_unixsrc.tar.bz2
cd vnc_unixsrc
bunzip2 -c ~/diet-pc-src/tightvnc-1.3.9-dietpc-patch.bz2 | patch -p1 -b
xmkmf -a
vi {libvncauth,vncpasswd,vncviewer}/Makefile	# change CDEBUGFLAGS to
						# "$CFLAGS -fno-strict-aliasing"
make -C libvncauth
make -C vncpasswd
make -C vncviewer XAWLIB=/usr/X11R6/lib/libXaw.so.6 XPMLIB=
	# or /usr/lib/libXaw.so.6, if your development box has it there instead
strip -R .note -R .comment vncpasswd/vncpasswd vncviewer/vncviewer
mkdir -p ~/diet-pc/rfb/extras ~/diet-pc/xserver_xorg_vnc/extras \
	~/diet-pc/xserver_xvnc/extras
mkdir -p ~/diet-pc/rfb/files/usr/X11R6/bin
cp vncpasswd/vncpasswd ~/diet-pc/rfb/extras/
cp vncpasswd/vncpasswd ~/diet-pc/xserver_xorg_vnc/extras/
cp vncpasswd/vncpasswd ~/diet-pc/xserver_xvnc/extras/
cp vncviewer/vncviewer ~/diet-pc/rfb/files/usr/X11R6/bin/
~/diet-pc/tools/man2txt vncpasswd/vncpasswd.man >\
	~/diet-pc/rfb/extras/vncpasswd.txt
~/diet-pc/tools/man2txt vncviewer/vncviewer.man >~/diet-pc/rfb/vncviewer.txt
cd ..
rm -rf vnc_unixsrc

tzdata 2007i

If you have DIET-PCs in multiple timezones, it may be more convenient to pass a TZ kernel parameter via the boot loader (see tzset(3) manpage) than to create separate boot images with different /etc/localtime files.

mkdir tzdata2007i
cd tzdata2007i
tar xzf ~/diet-pc-src/tzdata2007i.tar.gz
/usr/sbin/zic -d . australasia	# or other region as required
mkdir -p ~/diet-pc/shell/files/etc
cp Australia/Sydney ~/diet-pc/shell/files/etc/localtime	# or other zone as
							# required
cd ..
rm -rf tzdata2007i

ucl 1.03

UCL is required by UPX, so we'll compile and install a static version of the library on your build host.

You probably won't need to do this on Debian, try "apt-get install libucl-dev".

tar xzf ~/diet-pc-src/ucl-1.03.tar.gz
cd ucl-1.03
CFLAGS=-O3 ./configure --prefix=/usr/local
make
sudo make install
cd ..
rm -rf ucl-1.03

udev 0.118

Ignore the udev distribution's claims of a minimum kernel version of 2.6.15, demands to disable /sbin/hotplug, and insistence that test-udev is "only for testing". In practice, udev will still work satisfactorily with older 2.6 kernels as long as test-udev is installed as /sbin/udev and /bin/hotplug still calls it.

It boggles the mind that the 2.6 kernel was released without stable userspace tools, and worse, that the udev developers seem to have no intention of ever providing stable releases, and change their minds like they change their socks. The fact that the udev version number no longer starts with zero does not imply that it is in any way "stable".

tar xjf ~/diet-pc-src/udev-118.tar.bz2
cd udev-118
make EXTRAS=extras/volume_id VOLUME_ID_STATIC=true
strip -R .note -R .comment test-udev udevadm udevd extras/volume_id/vol_id
mkdir -p ~/diet-pc/shell/files/sbin
mkdir -p ~/diet-pc/shell/files/etc/udev/rules.d
cp test-udev ~/diet-pc/shell/files/sbin/udev
cp udevadm udevd ~/diet-pc/shell/files/sbin/
#mkdir -p ~/diet-pc/storageserver/files/sbin
#cp extras/volume_id/vol_id ~/diet-pc/storageserver/files/sbin
cd ..
rm -rf udev-118

unzip 5.52

tar xzf ~/diet-pc-src/unzip552.tar.gz
cd unzip-5.52
vi unix/Makefile	# Substitute $CFLAGS for "-O3" in linux section (x86)
			# or linux_noasm section (x86_64/PPC/ARM/MIPSEL)
make -f unix/Makefile linux
# (PPC/ARM/x86_64/MIPSEL: make -f unix/Makefile linux_noasm)
strip -R .note -R .comment unzip
mkdir -p ~/diet-pc/shell/files/usr/bin
cp unzip ~/diet-pc/shell/files/usr/bin/
cd ..
rm -rf unzip-5.52

upx 3.02

The ucl library is a prerequisite for this package.

tar xjf ~/diet-pc-src/upx-3.02-src.tar.bz2
cd upx-3.02-src/src
export UCLDIR=/usr/local	# Not necessary if using Debian's libucl-dev
vi Makefile			# Remove "-O2" from CXXFLAGS
make
#(ARM: make CXXFLAGS="$CFLAGS -DACC_ABI_LITTLE_ENDIAN")
gcc -static-libgcc -o upx *.o -L/usr/local -Wl,-Bstatic -lucl -lstdc++ \
	-Wl,-Bdynamic -lz
# Or, if you compiled using g++-2.95:
#gcc-2.95 -o upx *.o -L/usr/local -Wl,-Bstatic -lucl -lstdc++ -Wl,-Bdynamic \
#	-lz
strip -R .note -R .comment upx
mkdir -p ~/diet-pc/tools
cp upx ~/diet-pc/tools/
cd ../doc
make
mkdir -p ~/diet-pc/tools-doc
~/diet-pc/tools/man2txt upx.1 >~/diet-pc/tools-doc/upx.txt
cd ../..
rm -rf upx-3.01-src

usbutils 0.11

Can be found at http://wwwbode.cs.tum.edu/Par/arch/usb/download/usbutils/.

tar xzf ~/diet-pc-src/usbutils-0.11.tar.gz
cd usbutils-0.11
# Provided config.sub is too old to handle some architectures (eg. x86_64),
# so substitute an up-to-date one:
amvers=`automake --version | awk '{print $NF; exit}' | cut -f1-2 -d.`
rm config.sub
ln -s /usr/share/automake-$amvers/config.sub
./configure --prefix=''
make
strip -R .note -R .comment usbmodules
mkdir -p ~/diet-pc/shell/files/sbin
cp usbmodules ~/diet-pc/shell/files/sbin/
cd ..
rm -rf usbutils-0.11

util-linux 2.12r

tar xjf ~/diet-pc-src/util-linux-2.12r.tar.bz2
cd util-linux-2.12r
vi MCONFIG	# change CPUTAIL=486 to CPUTAIL=686 and substitute -Os for -O2
		# in the 'ifeq "$(ARCH)" "intel"' section
# (x86_64: don't modify CPUTAIL, change CPUOPT=-m64)
# (PPC and MIPSEL: change default OPT= case (just before WARNFLAGS) to "$CFLAGS
# -fomit-frame-pointer" instead)
# (ARM: change the OPT flags in the ifeq "$(ARCH)" "arm" case to "$CFLAGS -pipe
# -fsigned-char -fomit-frame-pointer")
vi configure	# comment out "CFLAGS=${CFLAGS-"-O2"}"
./configure
vi make_include		# change to "HAVE_BLKID=no" if it is not already
vi mount/realpath.c	# change to "#undef resolve_symlinks"
make -C lib
make -C disk-utils mkfs
make -C disk-utils mkfs.cramfs
make -C misc-utils mcookie
make -C mount mount
strip -R .note -R .comment disk-utils/mkfs disk-utils/mkfs.cramfs \
	misc-utils/mcookie mount/mount
mkdir -p ~/diet-pc/persistfs/files/sbin ~/diet-pc/xcore/files/usr/bin
mkdir -p ~/diet-pc/remotefs/files/bin ~/diet-pc/storageserver/files/bin
mkdir -p ~/diet-pc/tools
cp disk-utils/mkfs ~/diet-pc/persistfs/files/sbin/
cp disk-utils/mkfs.cramfs ~/diet-pc/tools/mkcramfs
cp misc-utils/mcookie ~/diet-pc/xcore/files/usr/bin/
cp mount/mount ~/diet-pc/remotefs/files/bin/
cp mount/mount ~/diet-pc/storageserver/files/bin/
cd ..
rm -rf util-linux-2.12r

wireless_tools 29

tar xzf ~/diet-pc-src/wireless_tools.29.tar.gz
cd wireless_tools.29
vi Makefile	# Set PREFIX=, BUILD_STATIC=y, modify CFLAGS as required
make iwmulticall
strip -R .note -R .comment iwmulticall
mkdir -p ~/diet-pc/wireless/files/sbin
cp iwmulticall ~/diet-pc/wireless/files/sbin/
ln -s iwmulticall ~/diet-pc/wireless/files/sbin/iwconfig
ln -s iwmulticall ~/diet-pc/wireless/files/sbin/iwlist
ln -s iwmulticall ~/diet-pc/wireless/files/sbin/iwspy
ln -s iwmulticall ~/diet-pc/wireless/files/sbin/iwpriv
ln -s iwmulticall ~/diet-pc/wireless/files/sbin/iwgetid
~/diet-pc/tools/man2txt iwconfig.8 >~/diet-pc/wireless/iwconfig.txt
cd ..
rm -rf wireless_tools.29

wpa_supplicant 0.5.9

tar xzf ~/diet-pc-src/wpa_supplicant-0.5.9.tar.gz
cd wpa_supplicant-0.5.9
cp defconfig .config
vi .config	# Uncomment CONFIG_DRIVER_NDISWRAPPER=y, CONFIG_DRIVER_IPW=y,
		# CONFIG_INTERNAL_LIBTOMMATH=y; set CONFIG_TLS=internal
make
strip -R .note -R .comment wpa_supplicant wpa_passphrase
mkdir -p ~/diet-pc/wireless/files/sbin ~/diet-pc/wireless/files/etc \
	~/diet-pc/wireless/extras
cp wpa_supplicant ~/diet-pc/wireless/files/sbin/
cp wpa_supplicant.conf ~/diet-pc/wireless/wpa_supplicant.conf.eg
cp wpa_passphrase ~/diet-pc/wireless/extras/
~/diet-pc/tools/man2txt doc/docbook/wpa_supplicant.8 \
	>~/diet-pc/wireless/wpa_supplicant.txt
~/diet-pc/tools/man2txt doc/docbook/wpa_supplicant.conf.5 \
	>~/diet-pc/wireless/wpa_supplicant.conf.txt
cd ..
rm -rf wpa_supplicant-0.5.9

wu-ftpd CVS

WU-FTPD no longer appears to be maintained (it had a history of security problems, and was abandoned in favour of VSFTPD et al). Nevertheless it remains the FTP server of choice for DIET-PC because of its FTP conversions feature (on-the-fly compression and archiving). Note, however, that WU-FTPD 2.6.2 is not adequate for DIET-PC purposes - you will get segfaults. Hence you should use a CVS snapshot available from ftp://ftp.wu-ftpd.org/private/nocvs/wuftpd-cvs-current.tar.gz.

tar xzf ~/diet-pc-src/wuftpd-cvs-current.tar.gz
cd wu-ftpd
./configure --prefix=/usr --disable-private --enable-anononly --disable-pam \
	--disable-log-rp --disable-virtual --disable-mail --enable-badclients \
	--enable-rfc931 --disable-ipv6
vi config.h		# add "#define LIBWRAP"
vi src/Makefile		# append -lwrap to LIBS
make -C support
make -C src ftpd
strip -R .note -R .comment src/ftpd
mkdir -p ~/diet-pc/storageserver/files/usr/sbin
cp src/ftpd ~/diet-pc/storageserver/files/usr/sbin/in.ftpd
~/diet-pc/tools/man2txt doc/ftpaccess.5 \
	>~/diet-pc/storageserver/ftpaccess.txt
~/diet-pc/tools/man2txt doc/ftpconversions.5 \
	>~/diet-pc/storageserver/ftpconversions.txt
~/diet-pc/tools/man2txt doc/ftpd.8 >~/diet-pc/storageserver/ftpd.txt
cp LICENSE ~/diet-pc/storageserver/LICENSE.wu-ftpd
cd ..
rm -rf wu-ftpd

X11R6.9.0 (X.Org)

mgadriver-x86-4.2.0-src.tar.gz is available from ftp://ftp.matrox.com/pub/mga/archive/linux/2005/. You cannot use version 4.3.0 or later.

If your root account aliases cp and rm such that they use the "-i" option by default, you should unalias these before attempting multi-line cut-and-pastes.

tar xzf ~/diet-pc-src/X11R6.9.0-src1.tar.gz
tar xzf ~/diet-pc-src/X11R6.9.0-src2.tar.gz
tar xzf ~/diet-pc-src/X11R6.9.0-src3.tar.gz
cd xc
bunzip2 -c ~/diet-pc-src/x11r6.9.0-cidfonts.diff.bz2 | patch -p0 -b
# FIXME: wrong patchlevel in x11r6.9.0-dbe-render.diff.bz2
bunzip2 -c ~/diet-pc-src/x11r6.9.0-dbe-render.diff.bz2 | patch -p0 -b
bunzip2 -c ~/diet-pc-src/x11r6.9.0-geteuid.diff.bz2 | patch -p0 -b
bunzip2 -c ~/diet-pc-src/x11r6.9.0-mitri.diff.bz2 | patch -p0 -b
bunzip2 -c ~/diet-pc-src/x11r6.9.0-setuid.diff.bz2 | patch -p1 -b -f
# Errors from the setuid diff are benign and may be ignored.
bunzip2 -c ~/diet-pc-src/X11R6.9.0-dietpc-diff.bz2 | patch -p1 -b
tar xzOf ~/diet-pc-src/mgadriver-4.2.0-src.tar.gz \
	mgadriver-4.2.0-src/6.8.2/mga/HALlib/mgaHALlib.a \
	>programs/Xserver/hw/xfree86/drivers/mga/HALlib/mgaHALlib.a
# PPC/ARM/MIPSEL instructions:
# - vesa driver is not available for this platform, we will use fbdev instead.
# - change HaveMatroxHal NO (or delete it) in config/cf/xorgsite.def.
# - add "#define OptimizedCDebugFlags	$CFLAGS -static-libgcc" to DIET-PC
#   section in config/cf/site.def.
make World

export LD_LIBRARY_PATH=exports/lib
strip -R .note -R .comment exports/lib/lib*.so.?
find exports/lib/modules -name \*.so -exec strip -R .note -R .comment {} \;

mkdir -p ~/diet-pc/xcore/files/usr/X11R6/bin
rm programs/xauth/xauth
make -C programs/xauth xauth XMUULIB='-Wl,-Bstatic -lXmuu -Wl,-Bdynamic'
strip -R .note -R .comment programs/xauth/xauth
cp programs/xauth/xauth ~/diet-pc/xcore/files/usr/X11R6/bin/

mkdir -p ~/diet-pc/xcore/files/usr/X11R6/lib/X11/fonts/{75dpi,misc}
cp exports/lib/lib{X11,Xext}.so.6 ~/diet-pc/xcore/files/usr/X11R6/lib/
cp programs/rgb/rgb.txt lib/X11/XKeysymDB \
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/
programs/bdftopcf/bdftopcf fonts/bdf/75dpi/helvB12-L1.bdf | gzip -9 >\
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/fonts/75dpi/helvB12-L1.pcf.gz
programs/bdftopcf/bdftopcf fonts/bdf/misc/6x13-L1.bdf | gzip -9 >\
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/fonts/misc/6x13-L1.pcf.gz
programs/bdftopcf/bdftopcf fonts/bdf/misc/cursor.bdf | gzip -9 >\
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/fonts/misc/cursor.pcf.gz
touch ~/diet-pc/xcore/files/usr/X11R6/lib/X11/fonts/75dpi/fonts.alias
cat >~/diet-pc/xcore/files/usr/X11R6/lib/X11/fonts/misc/fonts.alias <<EOF
fixed		-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
variable	-*-helvetica-bold-r-normal-*-*-120-*-*-*-*-iso8859-1
6x13		-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
EOF
programs/mkfontscale/mkfontscale -b -s -l \
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/fonts/{75dpi,misc}

mkdir -p ~/diet-pc/xcore/extras/keymaps
cp programs/xkbcomp/keymap/xfree86 ~/diet-pc/xcore/extras/keymaps/
for keymap in `grep '^xkb_keymap' programs/xkbcomp/keymap/xfree86 | cut -f2 \
	-d \"`; do
    programs/xkbcomp/xkbcomp -Iprograms/xkbcomp -dflts -xkm -m $keymap \
	    programs/xkbcomp/keymap/xfree86 \
	    ~/diet-pc/xcore/extras/keymaps/$keymap.xkm
done
mkdir -p ~/diet-pc/xcore/files/usr/X11R6/lib/X11/xkb/compiled
cp ~/diet-pc/xcore/extras/keymaps/en_US.xkm \
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/xkb/compiled/default.xkm
	# Or other file to suit your locale

mkdir -p ~/diet-pc/xserver_xorg/files/usr/X11R6/lib/X11/xserver
cp programs/Xserver/Xext/SecurityPolicy \
	~/diet-pc/xserver_xorg/files/usr/X11R6/lib/X11/xserver/
mkdir -p ~/diet-pc/xserver_xorg/files/usr/X11R6/bin
strip -R .note -R .comment programs/Xserver/Xorg
cp programs/Xserver/Xorg ~/diet-pc/xserver_xorg/files/usr/X11R6/bin/
mkdir -p ~/diet-pc/xserver_xorg/files/usr/X11R6/lib/modules/{drivers,extensions,fonts,input,linux}
~/diet-pc/tools/man2txt programs/Xserver/Xserver._man \
	>~/diet-pc/xserver_xorg/Xserver.txt
~/diet-pc/tools/man2txt programs/Xserver/hw/xfree86/Xorg._man \
	>~/diet-pc/xserver_xorg/Xorg.txt
~/diet-pc/tools/man2txt programs/Xserver/hw/xfree86/xorg.conf._man \
	>~/diet-pc/xserver_xorg/xorg.conf.txt
~/diet-pc/tools/man2txt programs/Xserver/hw/xfree86/drivers/vesa/vesa._man \
	>~/diet-pc/xserver_xorg/vesa.txt
# (PPC/ARM/MIPSEL: substitute fbdev/fbdev._man and fbdev.txt for vesa/vesa._man
# and vesa.txt)
for module in drivers/vesa_drv.so extensions/libdbe.so extensions/libextmod.so \
	fonts/libbitmap.so input/mouse_drv.so input/keyboard_drv.so libddc.so \
	libi2c.so libpcidata.so libshadow.so libvbe.so libfb.so \
	linux/libint10.so; do
    cp exports/lib/modules/$module \
	    ~/diet-pc/xserver_xorg/files/usr/X11R6/lib/modules/$module
done
# (PPC/ARM/MIPSEL: vesa_drv.so and libint10.so are not built, substitute
# fbdev_drv.so and libfbdevhw.so respectively; omit libvbe.so)

for driver in atimisc cirrus fglrx i810 i740 mga nv r128 radeon s3 savage \
	trident via vmware; do
    mkdir -p ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules/drivers
    if [ -f programs/Xserver/hw/xfree86/drivers/$driver/$driver._man ]; then
	~/diet-pc/tools/man2txt \
		programs/Xserver/hw/xfree86/drivers/$driver/$driver._man \
		>~/diet-pc/xserver_xorg_$driver/$driver.txt
    fi
    cp exports/lib/modules/lib{ramdac,vgahw,xaa}.so \
	    ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules
    if [ -f exports/lib/modules/drivers/${driver}_drv.so ]; then
	cp exports/lib/modules/drivers/${driver}_drv.so \
		~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules/drivers
    fi
done

mkdir -p ~/diet-pc/xserver_xorg_nvidia/files/usr/X11R6/lib/modules
cp exports/lib/modules/libramdac.so \
	~/diet-pc/xserver_xorg_nvidia/files/usr/X11R6/lib/modules/

mkdir -p ~/diet-pc/xserver_xorg_mga/files/usr/X11R6/lib/modules/drivers
cp exports/lib/modules/librac.so \
	~/diet-pc/xserver_xorg_mga/files/usr/X11R6/lib/modules/
# (PPC/ARM/MIPSEL: mga_hal_drv.so is not built, skip next command)
cp exports/lib/modules/drivers/mga_hal_drv.so \
	~/diet-pc/xserver_xorg_mga/files/usr/X11R6/lib/modules/drivers/

for driver in atimisc r128 radeon; do
    cp exports/lib/modules/drivers/ati_drv.so \
	    ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules/drivers
    if [ -f programs/Xserver/hw/xfree86/drivers/ati/$driver._man ]; then
	~/diet-pc/tools/man2txt \
		programs/Xserver/hw/xfree86/drivers/ati/$driver._man \
		>~/diet-pc/xserver_xorg_$driver/$driver.txt
    fi
done

# (PPC/ARM/MIPSEL: cirrus drivers not built, skip next command)
cp exports/lib/modules/drivers/cirrus_{alpine,laguna}.so \
	~/diet-pc/xserver_xorg_cirrus/files/usr/X11R6/lib/modules/drivers/

for driver in i810 r128 radeon vmware; do
    mkdir -p ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules
    cp exports/lib/modules/libshadowfb.so \
	    ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules
done

# (ARM: DRI not supported at all, so skip next two blocks entirely)
for driver in fglrx i810 mga r128 radeon via; do
    mkdir -p ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules/{dri,extensions,linux}
    cp exports/lib/lib{GL,Xxf86vm}.so.1 \
	    ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib
    if [ -f exports/lib/modules/dri/${driver}_dri.so ]; then
	cp exports/lib/modules/dri/${driver}_dri.so \
	        ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules/dri
    fi
    cp exports/lib/modules/extensions/lib{dri,GLcore,glx}.so \
	    ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules/extensions
    cp exports/lib/modules/linux/libdrm.so \
	    ~/diet-pc/xserver_xorg_$driver/files/usr/X11R6/lib/modules/linux
done
mkdir -p ~/diet-pc/mmedia_xine/extras
cp exports/lib/lib{GL,Xxf86vm}.so.1 ~/diet-pc/mmedia_xine/extras/
rm ~/diet-pc/xserver_xorg_fglrx/files/usr/X11R6/lib/libGL.so.1

# (PPC: i810 and via drivers are not built, so skip this block)
cp exports/lib/modules/dri/i915_dri.so \
	~/diet-pc/xserver_xorg_i810/files/usr/X11R6/lib/modules/dri/
cp exports/lib/modules/dri/r200_dri.so \
	~/diet-pc/xserver_xorg_radeon/files/usr/X11R6/lib/modules/dri/
cp exports/lib/libI810XvMC.so.1.0 \
	~/diet-pc/xserver_xorg_i810/files/usr/X11R6/lib/
rm ~/diet-pc/xserver_xorg_via/files/usr/X11R6/lib/lib{GL,Xxf86vm}.so.1
cp exports/lib/libviaXvMC.so.1 exports/lib/libviaXvMCPro.so.1 \
	~/diet-pc/xserver_xorg_via/files/usr/X11R6/lib/

mkdir -p ~/diet-pc/mmedia_xine/files/usr/X11R6/lib
cp exports/lib/libXv.so.1 exports/lib/libXinerama.so.1 \
	exports/lib/libXvMCW.so.1 exports/lib/libXvMC.so.1 \
	~/diet-pc/mmedia_xine/files/usr/X11R6/lib/

for pkg in http_opera ica rfb ssh; do
    mkdir -p ~/diet-pc/$pkg/files/usr/X11R6/lib
    cp exports/lib/lib{ICE,SM,Xmu,Xt}.so.6  ~/diet-pc/$pkg/files/usr/X11R6/lib
done
rm ~/diet-pc/ssh/files/usr/X11R6/lib/libXmu.so.6

rm programs/xset/xset
make -C programs/xset xset XMUULIB='-Wl,-Bstatic -lXmuu -Wl,-Bdynamic' \
	XXF86MISCLIB='-Wl,-Bstatic -lXxf86misc -Wl,-Bdynamic' \
	XPLIB='-Wl,-Bstatic -lXp -Wl,-Bdynamic'
strip -R .note -R .comment programs/xset/xset
mkdir -p ~/diet-pc/mmedia_xine/files/usr/X11R6/bin
cp programs/xset/xset ~/diet-pc/mmedia_xine/files/usr/X11R6/bin/

rm programs/xmessage/xmessage
make -C programs/xmessage xmessage XAWLIB='../../exports/lib/libXaw.so.6' \
	XPMLIB='' XPLIB=''
strip -R .note -R .comment programs/xmessage/xmessage
mkdir -p ~/diet-pc/ica/files/usr/X11R6/bin ~/diet-pc/rfb/files/usr/X11R6/bin \
	~/diet-pc/http_opera/files/usr/X11R6/bin
cp programs/xmessage/xmessage ~/diet-pc/ica/files/usr/X11R6/bin/
cp programs/xmessage/xmessage ~/diet-pc/rfb/files/usr/X11R6/bin/
cp programs/xmessage/xmessage ~/diet-pc/http_opera/files/usr/X11R6/bin/

rm programs/xdpyinfo/xdpyinfo
make -C programs/xdpyinfo xdpyinfo LOCAL_LIBRARIES='-Wl,-Bstatic -ldmx -lXi \
	-lXtst -lXxf86dga -lXrender -lXinerama -lXxf86misc -lXxf86vm \
	-Wl,-Bdynamic -lXp -lX11 -lXext'
strip -R .note -R .comment programs/xdpyinfo/xdpyinfo
cp programs/xdpyinfo/xdpyinfo ~/diet-pc/ica/files/usr/X11R6/bin/

mkdir -p ~/diet-pc/ica/files/usr/X11R6/lib \
	~/diet-pc/rfbserver/files/usr/X11R6/lib
cp exports/lib/libXp.so.6 exports/lib/libXpm.so.4 \
	~/diet-pc/ica/files/usr/X11R6/lib/
cp exports/lib/libXpm.so.4 ~/diet-pc/rfbserver/files/usr/X11R6/lib/

mkdir -p ~/diet-pc/xcore/files/usr/X11R6/lib/X11/locale/lib/common
cp -Lr exports/lib/locale/{C,iso8859-1} \
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/locale/
strip -R .note -R .comment exports/lib/locale/lib/common/*.so.?
cp exports/lib/locale/lib/common/{ximcp,xlcDef,xomGeneric}.so.2 \
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/locale/lib/common/
chmod 755 ~/diet-pc/xcore/files/usr/X11R6/lib/X11/locale/lib/common/*.so.?
cp exports/lib/locale/*.{dir,alias} \
	~/diet-pc/xcore/files/usr/X11R6/lib/X11/locale/

cd ..
tar cjf xorg690.tar.bz2 xc	# Retain a copy of the build tree, as you may
				# need to borrow additional libraries from it
rm -rf xc

X11R7.2/3 (X.Org)

Build instructions for modular Xorg (X11R7.x) aren't finished yet, and in any case are much too verbose to inline here. See xorg7_build.txt for interim build instructions.


x11-ssh-askpass 1.2.4.1

tar xzf ~/diet-pc-src/x11-ssh-askpass-1.2.4.1.tar.gz
cd x11-ssh-askpass-1.2.4.1
vi SshAskpass-default.ad	# uncomment "*grabServer"
./configure --prefix=/usr/X11R6
xmkmf
make includes
make
strip -R .note -R .comment x11-ssh-askpass
mkdir -p ~/diet-pc/ssh/files/usr/X11R6/bin
cp x11-ssh-askpass ~/diet-pc/ssh/files/usr/X11R6/bin/
rm x11-ssh-askpass
make LOCAL_LIBRARIES="-lX11 -Wl,-Bstatic -lXt -lSM -lICE -Wl,-Bdynamic"
strip -R .note -R .comment x11-ssh-askpass
mkdir -p ~/diet-pc/ssh/extras
cp x11-ssh-askpass ~/diet-pc/ssh/extras/
cd ..
rm -rf x11-ssh-askpass-1.2.4.1

Xaw95 1.1

tar xzf ~/diet-pc-src/Xaw95-1.1-src.tar.gz
cd Xaw95-1.1
gunzip -c ~/diet-pc-src/Xaw95-1.1-dietpc-patch.gz | patch -p1 -b
sudo mv /usr/include/X11/Xaw3d /usr/include/X11/Xaw3d.orig
# (only if this directory exists; may be located at
# /usr/X11R6/include/X11/Xaw3d on older systems, modify as appropriate)
sudo ln -s `pwd` /usr/include/X11/Xaw3d # (or /usr/X11R6/include/X11/Xaw3d)
xmkmf
make includes
make depend
vi Makefile	# change "CDEBUGFLAGS = $CFLAGS -fno-strict-aliasing"
		# (multiple occurences)
make SOXAWREV=6.0 XPMLIB=
gcc -o libXaw.so.7 -shared libXaw.so.6
strip -R .note -R .comment libXaw.so.6 libXaw.so.7
mkdir -p ~/diet-pc/http_opera/files/usr/X11R6/lib
mkdir -p ~/diet-pc/ica/files/usr/X11R6/lib
mkdir -p ~/diet-pc/rfb/files/usr/X11R6/lib
cp libXaw.so.6 ~/diet-pc/http_opera/files/usr/X11R6/lib/
cp libXaw.so.6 ~/diet-pc/rfb/files/usr/X11R6/lib/
cp libXaw.so.6 ~/diet-pc/ica/files/usr/X11R6/lib/
cp libXaw.so.7 ~/diet-pc/ica/files/usr/X11R6/lib/
sudo rm /usr/include/X11/Xaw3d
sudo mv /usr/include/X11/Xaw3d.orig /usr/include/X11/Xaw3d
# (or /usr/X11R6/include/X11/Xaw3d)
cd ..
rm -rf Xaw95-1.1

xclass 0.9.2

Note that this configuration is no good for compiling xclass applications to run locally, since OX_DEFAULT_POOL and OX_DEFAULT_ROOT do not match the prefix used. A prefix of /usr/local is only used here to avoid installing software in /usr that is not under the control of your Linux distro's package manager.

xclass is required to build x0rfbserver (rfb). Although you may use your platform's xclass library (if available) instead of building one, this build of the xclass library is optimised for space, to ensure a smaller x0rfbserver binary.

tar xzf ~/diet-pc-src/xclass-0.9.2.tar.gz
cd xclass-0.9.2
vi lib/libxclass/Makefile.in
			# change "DEFINES=
			# -DOX_DEFAULT_POOL=\"/usr/X11R6/share/xclass/icons\"
			# -DOX_DEFAULT_ROOT=\"\""
# A couple of tweaks are needed for gcc 4.1:
vi +764 lib/libxclass/OGifImage.cc      # Change the type of "c" from "char"
                                        # to "signed char"
vi +599 ./lib/libxclass/OXHtmlParse.cc  # Change "-128" to "(char)-128"
# cflags_set=se gets around a configure stupidity
cflags_set=set CXX=g++-2.95 ./configure --prefix=/usr/local --disable-opengl
make
sudo make install
cd ..
rm -rf xclass-0.9.2

xf4vnc CVS

XF4VNC sources are only available via CVS.

mkdir xf4vnc
cd xf4vnc
cvs -d:pserver:anonymous@xf4vnc.cvs.sourceforge.net:/cvsroot/xf4vnc login
cvs -z3 -d:pserver:anonymous@xf4vnc.cvs.sourceforge.net:/cvsroot/xf4vnc co .
cvs -d:pserver:anonymous@xf4vnc.cvs.sourceforge.net:/cvsroot/xf4vnc logout
cd xc
vi config/cf/host.def	# Uncomment GccWarningOptions and
				# DefaultCCOptions, change "-g -O2" to
				# $CFLAGS in DefaultCCOptions
vi config/cf/site.def	# Add "#define BuildIPv6 NO" in "AfterVendorCF"
			# section
make World	# This will fail, but don't worry
cd ../libvncauth
imake -I../xc/config/cf
make
cd ../xc
# (PPC: vi programs/Xserver/hw/xfree86/drivers/imstt/imstt_reg.h, change two
# references to "asm" to "__asm__" (problem might be specific to gcc 3.3.3))
# (MIPSEL:
# vi config/cf/linux.cf		# Remove the "|| defined # (MipsArchitecture)"
#			 	# clause just before "#define DoLoadableServer
#				# NO"
# If compilation fails with an error relating to a missing libi2c.a, do the
# following:
# pushd  programs/Xserver/hw/xfree86/i2c
# xmkmf ../../../../..
# make
# popd
# make
# )
make
rm -f programs/Xserver/Xvnc
make -C programs/Xserver FREETYPE2LIB='-Wl,-Bstatic -lfreetype -Wl,-Bdynamic'
strip -R .note -R .comment programs/Xserver/Xvnc exports/lib/modules/vnc.so
mkdir -p ~/diet-pc/xserver_xvnc/files/usr/X11R6/bin
mkdir -p ~/diet-pc/xserver_xvnc/files/usr/X11R6/lib/X11/xserver
cp programs/Xserver/Xvnc ~/diet-pc/xserver_xvnc/files/usr/X11R6/bin/
cp programs/Xserver/Xext/SecurityPolicy \
	~/diet-pc/xserver_xvnc/files/usr/X11R6/lib/X11/xserver/
~/diet-pc/tools/man2txt programs/Xserver/Xserver._man \
	>~/diet-pc/xserver_xvnc/Xserver.txt
mkdir -p ~/diet-pc/xserver_xorg_vnc/files/usr/X11R6/lib/modules/extensions
cp exports/lib/modules/vnc.so \
	~/diet-pc/xserver_xorg_vnc/files/usr/X11R6/lib/modules/extensions/
cd ../..
rm -rf xf4vnc

XFree86 3.3.6

N.B. Fixes 09 and 10 in the X336fixes.tar.gz bundle are unofficial and DIET-PC-specific.

XFree86 3.3.6 won't compile for ARM - it looks like the ARM architecture wasn't properly supported until XFree86 4.x. Nor will it compile for x86_64. It doesn't seem terribly useful on PPC either, for that matter!

mkdir xfree86-3.3.6
cd xfree86-3.3.6
tar xzf ~/diet-pc-src/X336src-1.tgz
cd xc
tar xzf ~/diet-pc-src/X336fixes.tar.gz
for fix in X336fixes/*; do
    if [ "$fix" = 'X336fixes/fix-04-s3trio3d2x' ]; then
	patch -p2 -E <$fix
    else
	patch -p1 -E <$fix
    fi
done
# PPC instructions:
# - we're building XF86_FBDev, not XF86_SVGA
# - don't apply fix-09-modern_glibc patch
# - need to "#define OptimizedCDebugFlags   -static-libgcc $CFLAGS" in
#   AfterVendorCF section of config/cf/site.def
# - add "volatile" to definitions of GLINTMMIOBase and glintVideoMem in
#   programs/Xserver/hw/xfree68/pm2/pm2_accel.h and
#   programs/Xserver/hw/xfree68/pm2/pm2fbdev.c
# - PPC doesn't have the ioperm system call, so add a dummy macro to
#   programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h as follows:
#   #ifdef __powerpc__
#   #define ioperm(x,y,z)	0
#   #endif
# - programs/Xserver/hw/xfree86/fbdev/Makefile doesn't get built for reasons
#   unknown, so:
#   - pushd programs/Xserver/hw/xfree86/fbdev
#   - xmkmf ../../../../../
#   - make (fails)
#   - vi fbdev.c (comment out #include of <stdlib.h>)
#   - make
#   - popd
make World
strip -R .note -R .comment programs/Xserver/XF86_SVGA
# (PPC: XF86_FBDev, not XF86_SVGA)
mkdir -p ~/diet-pc/xserver_xf3/files/usr/X11R6/bin
cp programs/Xserver/XF86_SVGA ~/diet-pc/xserver_xf3/files/usr/X11R6/bin/
mkdir -p ~/diet-pc/xserver_xf3/files/usr/X11R6/lib/X11/xserver
cp programs/Xserver/Xext/SecurityPolicy \
	~/diet-pc/xserver_xf3/files/usr/X11R6/lib/X11/xserver/
~/diet-pc/tools/man2txt programs/Xserver/Xserver.man >\
	~/diet-pc/xserver_xf3/Xserver.txt
~/diet-pc/tools/man2txt programs/Xserver/hw/xfree86/XF86_SVGA.man >\
	~/diet-pc/xserver_xf3/XF86_SVGA.txt
# (PPC: no manpage for XF86_FBDev)
cd ../..
rm -rf xfree86-3.3.6

XFree86 4.7.0

Only the Xvesa or Xfbdev TinyX server is used from the XFree86 distribution - X.Org is used for most other X11 components (modular X server, libraries and utility programs).

mkdir xfree86-4.7.0
cd xfree86-4.7.0
tar xzf ~/diet-pc-src/XFree86-4.7.0-src-1.tgz
tar xzf ~/diet-pc-src/XFree86-4.7.0-src-2.tgz
tar xzf ~/diet-pc-src/XFree86-4.7.0-src-3.tgz
cd xc
bunzip2 -c ~/diet-pc-src/XFree86-4.6.0-dietpc-patch.bz2 | patch -p1 -b
vi config/cf/xf86site.def	# Change "-mcpu=i686" to "-mtune=i686" to
				# suppress gcc deprecation warnings
# PPC/ARM/MIPSEL instructions:
# - We will build Xfbdev instead of Xvesa.
# - Set ServerToInstall to Xfbdev in config/cf/xf86site.def
# - Add "#define OptimizedCDebugFlags    -static-libgcc $CFLAGS" in
#   AfterVendorCF section of config/cf/site.def.
make World
strip -R .note -R .comment programs/Xserver/Xvesa
# (PPC/ARM/MIPSEL: Xfbdev instead of Xvesa)
mkdir -p ~/diet-pc/xserver_tinyx/files/usr/X11R6/bin
cp programs/Xserver/Xvesa ~/diet-pc/xserver_tinyx/files/usr/X11R6/bin/
# (PPC/ARM/MIPSEL: Xfbdev instead of Xvesa)
~/diet-pc/tools/man2txt programs/Xserver/Xserver._man >\
	~/diet-pc/xserver_tinyx/Xserver.txt
~/diet-pc/tools/man2txt programs/Xserver/hw/tinyx/TinyX._man >\
	~/diet-pc/xserver_tinyx/TinyX.txt
~/diet-pc/tools/man2txt programs/Xserver/hw/tinyx/vesa/Xvesa._man >\
	~/diet-pc/xserver_tinyx/Xvesa.txt
# (PPC/ARM/MIPSEL: fbdev/Xfbdev._man > Xfbdev.txt)
cd ../..
rm -rf xfree86-4.6.0

xine-lib 1.1.8

xine-lib is very awkward to compile for an embedded environment, because it links to many back-end shared libraries using libtool. The back-end libraries are often too big to include whole in an embedded environment, and we would prefer to link some of these libraries statically into Xine's loadable modules. Unfortunately libtool makes this very difficult.

Because of the (un)subtleties of libtool and because xine-lib needs to be installed in order to compile xine-ui, we need to install xine-lib to /opt/xine on your development platform. It's unlikely that this will clash with an already installed package, but it would pay to check first.

Unfortunately the instructions below are likely to be somewhat Debian-specific. Your distro's developer libraries might be static, shared or (hopefully in most cases) both, and may or may not be cross-linked to certain other libraries, and any number of development packages that xine-lib regards as optional (but which are required by my particular built) may be absent. Hence the only way to ensure a known state is to use the official DIET-PC development environment virtual machine for your platform.

For full functionality, you will need to install a lot of development packages (DEB, RPM, etc) on your development platform before compiling xine-lib. Probably the best way to find out what you are missing is simply to run the configure command and see what errors are reported (important bits will be heavily asterisked). You don't need to install everything that configure complains about. My build didn't include: (a) pointless ASCII art libraries (AALib, CACA), (b) libraries irrelevant to the Linux x86 platform (Libstk, DirectX, IRIX AL), (c) libraries that are only provided in shared form (JACK), and (d) libraries that have too many further dependencies to be viable in an embedded context (WAND, directfb, polypaudio, gnome_vfs, libsmbclient, SDL, freetype and modplug).

I used FAME as my MPEG encoder. Bizarrely, FAME is not available as a Debian package, so this needs to be built manually and installed to /usr/local first (see libfame section).

These intructions assume that your static X libraries are in /usr/lib, which is usual for X11R7. If you have an older X11R6-based distro, you may need to change some X library pathnames to use the /usr/X11R6/lib prefix instead.

Except in the case of freetype (which can be safely turned off using --disable-freetype), the way I have avoided autodetection of unwanted back-end capabilities was simply to uninstall the relevant *-dev DEBs / *-devel RPMs.

Note that although these instructions will allow you to build Xine for PowerPC, in all likelihood it won't work, because the PowerPC runtime linker can't reliably combine static and shared components in a shared library (due to use of 24-bit relative addressing in objects that are compiled without -fpic, resulting in possible out-of-range jumps). Libtool warns us that doing this isn't always portable, and indeed in this case it isn't. The same is likely to be true for x86_64 (not attempted yet).

tar xjf ~/diet-pc-src/xine-lib-1.1.8.tar.bz2
cd xine-lib-1.1.8
CFLAGS=-O3 PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig \
	./configure --prefix=/opt/xine --with-xv-path=/usr/lib \
	--with-w32-path=/opt/xine/lib/win32 --disable-freetype --disable-glu
make
cd src/demuxers
rm -f xineplug_dmx_ogg.la
make xineplug_dmx_ogg.la VORBIS_LIBS='/usr/lib/libvorbis.a -lm' \
	THEORA_LIBS=/usr/lib/libtheora.a OGG_LIBS=/usr/lib/libogg.a \
	SPEEX_LIBS=/usr/lib/libspeex.a
rm -f xineplug_dmx_mng.la
make xineplug_dmx_mng.la MNG_LIBS='/usr/lib/libmng.a /usr/lib/liblcms.a -lm \
	/usr/lib/libjpeg.a'
cd ../libxineadec
rm -f xineplug_decode_vorbis.la
make xineplug_decode_vorbis.la VORBIS_LIBS='/usr/lib/libvorbis.a -lm' \
	OGG_LIBS=/usr/lib/libogg.a
rm -f xineplug_decode_speex.la
make xineplug_decode_speex.la SPEEX_LIBS='/usr/lib/libspeex.a \
        /usr/lib/libogg.a -lm'
cd ../libxinevdec
rm -f xineplug_decode_gdk_pixbuf.la
make xineplug_decode_gdk_pixbuf.la \
	GDK_PIXBUF_LIBS='/usr/lib/libgdk_pixbuf-2.0.a -lm \
	/usr/lib/libgobject-2.0.a /usr/lib/libgmodule-2.0.a \
	/usr/lib/libglib-2.0.a /usr/lib/libtiff.a -lz /usr/lib/libjpeg.a \
	/usr/lib/libpng12.a'
rm -f xineplug_decode_theora.la
# The odd positioning of /usr/lib/libogg.a is needed to overcome a link-time
# ordering problem.
make xineplug_decode_theora.la THEORA_LIBS='/usr/lib/libtheora.a -lm \
	/usr/lib/libogg.a' OGG_LIBS=''
cd ../audio_out
rm -f xineplug_ao_out_esd.la
make xineplug_ao_out_esd.la ESD_LIBS='/usr/lib/libesd.a \
	/usr/lib/libaudiofile.a -lasound'
#rm -f xineplug_ao_out_arts.la
#make xineplug_ao_out_arts.la ARTS_LIBS=/usr/lib/libartsc.a
cd ../dxr3
rm -f xineplug_vo_out_dxr3.la
make xineplug_vo_out_dxr3.la LIBFAME_LIBS=/usr/local/lib/libfame.a
#cd ../video_out
#rm -f xineplug_vo_out_aa.la
#make xineplug_vo_out_aa.la AALIB_LIBS=/usr/lib/libaa.a
#rm -f xineplug_vo_out_caca.la
#make xineplug_vo_out_caca.la CACA_LIBS='/usr/lib/libcaca.a \
#	/usr/lib/libcucul.a /usr/lib/libslang.a /usr/lib/libncurses.a'
cd ../../misc
vi xine-config	# change portion as follows:
    # if test "$echo_libs" = "yes"; then
    #	echo -L${exec_prefix}/lib -Wl,-rpath -Wl,${exec_prefix}/lib -lxine
    # fi
gcc $CFLAGS -Wall -o cdda_server cdda_server.c -ldl
strip -R .note -R .comment cdda_server
mkdir -p ~/diet-pc/mmedia_xine/files/usr/sbin
cp cdda_server ~/diet-pc/mmedia_xine/files/usr/sbin/
cd ..
sudo make install
strip -R .note -R .comment /opt/xine/lib/libxine.so.1
strip -R .note -R .comment /opt/xine/lib/xine/plugins/1.1.7/*.so
strip -R .note -R .comment /opt/xine/lib/xine/plugins/1.1.7/*/*.so
cd ..
rm -rf xine-lib-1.1.8	# I suggest that you defer this until you're sure that
			# your plugins have no unforseen library dependencies.

xine-ui 0.99.5

Use of CURL will blow out the size of the binary and introduce OpenSSL dependencies, so I suggest removing the libcurl3-dev / curl-devel package so that configure won't detect and use it.

Because xine-ui's installation is fairly complex (and because you might like to use Xine on your development box also!), we will install xine-ui in full to /opt/xine on your development platform, and then prepare the DIET-PC mmedia_xine package from that.

tar xzf ~/diet-pc-src/xine-ui-0.99.5.tar.gz
cd xine-ui-0.99.5
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/xine/lib/pkgconfig \
	./configure --prefix=/opt/xine --with-xine-prefix=/opt/xine \
	--disable-xft
make
cd src/xitk
gcc -o xine-remote xine_remote-network.o ../common/libcommon.a \
	/usr/lib/libreadline.a /usr/lib/libtermcap.a -lpthread
gcc -o xine `ls *.o | grep -v xine_remote` \
	../common/libcommon.a xine-toolkit/libxitk.a oxine/liboxine.a \
	Imlib-light/libImlib-light.a ../common/libcommonx.a \
	/usr/lib/libpng.a /opt/xine/lib/libxine.so -Wl,-Bstatic -lpng \
	-lfontconfig -lexpat -llirc_client -L/usr/X11R6/lib -lXft -lXrender \
	-lXxf86vm -lXtst -Wl,-Bdynamic -L/usr/lib -lz -lm -lpthread -ldl \
	-L/usr/X11R6/lib -lX11 -lXext -lXv -lXinerama -Wl,--rpath \
	-Wl,/opt/xine/lib
cd ../fb
gcc -o fbxine *.o ../common/libcommon.a -Wl,-Bstatic -lncurses -llirc_client \
	-Wl,-Bdynamic /opt/xine/lib/libxine.so -L/usr/X11R6/lib -lX11 -lXext \
	-lXv -Wl,--rpath -Wl,/opt/xine/lib
cd ../..
sudo make install
strip -R .note -R .comment /opt/xine/bin/{fbxine,xine,xine-remote}
mkdir -p ~/diet-pc/mmedia_xine
~/diet-pc/tools/man2txt /opt/xine/man/man1/xine.1 \
	>~/diet-pc/mmedia_xine/xine.txt
~/diet-pc/tools/man2txt /opt/xine/man/man1/xine-remote.1 \
	>~/diet-pc/mmedia_xine/xine-remote.txt
# Certain modules' dependencies are way too complex for DIET-PC to handle, so
# we'll exclude them:
cat >/tmp/unembeddable.txt <<EOF
opt/xine/lib/xine/plugins/1.1.7/mime.types
opt/xine/lib/xine/plugins/1.1.7/xineplug_decode_image.so
opt/xine/lib/xine/plugins/1.1.7/xineplug_inp_gnome_vfs.so
opt/xine/lib/xine/plugins/1.1.7/xineplug_inp_smb.so
opt/xine/lib/xine/plugins/1.1.7/xineplug_vo_out_sdl.so
EOF
tar cCXf / /tmp/unembeddable.txt - opt/xine | bzip2 -9 \
	>~/diet-pc/mmedia_xine/xine.tar.bz2
cd ..
rm -rf xine-ui-0.99.5

yaboot 1.3.13

yaboot is specific to the PowerPC port of DIET-PC. It is available from http://penguinppc.org/bootloaders/yaboot/.

tar xzf ~/diet-pc-src/yaboot-1.3.13.tar.gz
cd yaboot-1.3.13
make
mkdir -p ~/diet-pc/templates/yaboot/diet-pc
mkdir -p ~/diet-pc/assembler_installer/files/sbin
cp second/yaboot ~/diet-pc/templates/yaboot/diet-pc/
cp ybin/ofpath ~/diet-pc/assembler_installer/files/sbin/
~/diet-pc/tools/man2txt man/yaboot.8 >~/diet-pc/tools-doc/yaboot.txt
~/diet-pc/tools/man2txt man/yaboot.conf.5 \
	>~/diet-pc/tools-doc/yaboot.conf.txt

zip 2.32

tar xzf ~/diet-pc-src/zip232.tar.gz
cd zip-2.32
vi unix/Makefile	# Remove "-O2" from CFLAGS
vi unix/configure	# Substitute $CFLAGS for "-O2" in CFLAGS just below
			# "Other (gcc?) (-O2)"
make -f unix/Makefile generic_gcc
strip -R .note -R .comment zip
mkdir -p ~/diet-pc/http_opera/files/usr/bin
mkdir -p ~/diet-pc/storageserver/files/usr/bin
cp zip ~/diet-pc/http_opera/files/usr/bin/
cp zip ~/diet-pc/storageserver/files/usr/bin/
cd ..
rm -rf zip-2.32

zlib 1.2.3

tar xjf ~/diet-pc-src/zlib-1.2.3.tar.bz2
cd zlib-1.2.3
CFLAGS="$CFLAGS -fPIC" ./configure --shared --prefix=''
make
strip -R .note -R .comment libz.so.1
mkdir -p ~/diet-pc/shell/files/lib
cp libz.so.1 ~/diet-pc/shell/files/lib/
cd ..
rm -rf zlib-1.2.3