3 # generate-release.sh: check out source trees, and build release components with
4 # totally clean, fresh trees.
6 # Usage: generate-release.sh svn-branch scratch-dir
8 # Environment variables:
9 # CVSUP_HOST: Host of a cvsup server to obtain the ports and documentation
10 # trees. This or CVSROOT must be set to include ports and documentation.
11 # CVSROOT: CVS root to obtain the ports and documentation trees. This or
12 # CVSUP_HOST must be set to include ports and documentation.
13 # CVS_TAG: CVS tag for ports and documentation (HEAD by default)
14 # SVNROOT: SVN URL to FreeBSD source repository (by default,
15 # svn://svn.freebsd.org/base)
16 # MAKE_FLAGS: optional flags to pass to make (e.g. -j)
18 # Note: Since this requires a chroot, release cross-builds will not work!
24 svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src || exit 1
25 if [ ! -z $CVSUP_HOST ]; then
26 cat > $2/docports-supfile << EOF
27 *default host=$CVSUP_HOST
30 *default release=cvs tag=${CVS_TAG:-.}
31 *default delete use-rel-suffix
36 elif [ ! -z $CVSROOT ]; then
38 cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} ports || exit 1
39 cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} doc || exit 1
43 make $MAKE_FLAGS buildworld || exit 1
44 make installworld distribution DESTDIR=$2 || exit 1
45 mount -t devfs devfs $2/dev
47 if [ ! -z $CVSUP_HOST ]; then
48 cp /etc/resolv.conf $2/etc/resolv.conf
50 # Checkout ports and doc trees
51 chroot $2 /usr/bin/csup /docports-supfile || exit 1
54 if [ -d $2/usr/doc ]; then
55 cp /etc/resolv.conf $2/etc/resolv.conf
57 # Build ports to build the docs, then build the docs
58 chroot $2 /bin/sh -c 'pkg_add -r docproj || (cd /usr/ports/textproc/docproj && make install clean BATCH=yes WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes)' || exit 1
59 chroot $2 /bin/sh -c "cd /usr/doc && make $MAKE_FLAGS 'FORMATS=html html-split txt' URLS_ABSOLUTE=YES" || exit 1
62 chroot $2 /bin/sh -c "cd /usr/src && make $MAKE_FLAGS buildworld buildkernel" || exit 1
63 chroot $2 /bin/sh -c "cd /usr/src/release && make release" || exit 1
64 chroot $2 /bin/sh -c "cd /usr/src/release && make install DESTDIR=/R" || exit 1