1#!/bin/sh
2#-
3# Copyright (c) 2013 Glen Barber
4# Copyright (c) 2011 Nathan Whitehorn
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
--- 15 unchanged lines hidden (view full) ---
24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26# SUCH DAMAGE.
27#
28# release.sh: check out source trees, and build release components with
29# totally clean, fresh trees.
30# Based on release/generate-release.sh written by Nathan Whitehorn
31#
32# $FreeBSD: head/release/release.sh 252101 2013-06-22 22:12:24Z gjb $
33#
34
35PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
36export PATH
37
38# The directory within which the release will be built.
39CHROOTDIR="/scratch"
40
41# The default svn checkout server, and svn branches for src/, doc/,
42# and ports/.
43SVNROOT="svn://svn.freebsd.org"
44SRCBRANCH="base/head"
45DOCBRANCH="doc/head"
46PORTBRANCH="ports/head"
47
48# The default src/, doc/, and ports/ revisions.
49SRCREVISION="-rHEAD"
50DOCREVISION="-rHEAD"
51PORTREVISION="-rHEAD"
52
53# The default make.conf and src.conf to use. Set to /dev/null
54# by default to avoid polluting the chroot(8) environment with
55# non-default settings.
--- 48 unchanged lines hidden (view full) ---
104 ;;
105 \?)
106 usage
107 ;;
108 esac
109done
110shift $(($OPTIND - 1))
111
112# The aggregated build-time flags based upon variables defined within
113# this file, unless overridden by release.conf. In most cases, these
114# will not need to be changed.
115CONF_FILES="__MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF}"
116ARCH_FLAGS="TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}"
117CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}"
118CHROOT_IMAKEFLAGS="${CONF_FILES}"
119CHROOT_DMAKEFLAGS="${CONF_FILES}"
120RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} ${CONF_FILES}"
121RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} KERNCONF=${KERNEL} ${ARCH_FLAGS} ${CONF_FILES}"
122RELEASE_RMAKEFLAGS="${ARCH_FLAGS} KERNCONF=${KERNEL} ${CONF_FILES} \
123 NODOC=${NODOC} NOPORTS=${NOPORTS}"
124
125# If PORTS is set and NODOC is unset, force NODOC=yes because the ports tree
126# is required to build the documentation set.
127if [ "x${NOPORTS}" != "x" ] && [ "x${NODOC}" = "x" ]; then
128 echo "*** NOTICE: Setting NODOC=1 since ports tree is required"
129 echo " and NOPORTS is set."
130 NODOC=1
131fi
132
133if [ ! ${CHROOTDIR} ]; then
134 echo "Please set CHROOTDIR."
135 exit 1
136fi
137
138if [ $(id -u) -ne 0 ]; then
139 echo "Needs to be run as root."
140 exit 1
141fi
142
143set -e # Everything must succeed
144
145mkdir -p ${CHROOTDIR}/usr
146
147svn co ${SVNROOT}/${SRCBRANCH} ${CHROOTDIR}/usr/src $SRCREVISION
148if [ "x${NODOC}" = "x" ]; then
149 svn co ${SVNROOT}/${DOCBRANCH} ${CHROOTDIR}/usr/doc $DOCREVISION
150fi
151if [ "x${NOPORTS}" = "x" ]; then
152 svn co ${SVNROOT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports $PORTREVISION
153fi
154
155get_rev_branch
156
157cd ${CHROOTDIR}/usr/src
158make ${CHROOT_WMAKEFLAGS} buildworld
159make ${CHROOT_IMAKEFLAGS} installworld DESTDIR=${CHROOTDIR}
160make ${CHROOT_DMAKEFLAGS} distribution DESTDIR=${CHROOTDIR}
161mount -t devfs devfs ${CHROOTDIR}/dev
162trap "umount ${CHROOTDIR}/dev" EXIT # Clean up devfs mount on exit
163
164build_doc_ports() {
165 ## Trick the ports 'run-autotools-fixup' target to do the right thing.
166 _OSVERSION=$(sysctl -n kern.osreldate)
167 if [ -d ${CHROOTDIR}/usr/doc ] && [ "x${NODOC}" != "x" ]; then
168 PBUILD_FLAGS="OSVERSION=${_OSVERSION} WITHOUT_JADETEX=yes BATCH=yes"
169 chroot ${CHROOTDIR} make -C /usr/ports/textproc/docproj \
170 ${PBUILD_FLAGS} install
171 fi
172}
173
174# If MAKE_CONF and/or SRC_CONF are set and not character devices (/dev/null),
175# copy them to the chroot.
176if [ -e ${MAKE_CONF} ] && [ ! -c ${MAKE_CONF} ]; then
177 mkdir -p ${CHROOTDIR}/$(dirname ${MAKE_CONF})
178 cp ${MAKE_CONF} ${CHROOTDIR}/${MAKE_CONF}
--- 7 unchanged lines hidden (view full) ---
186 cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf
187 build_doc_ports ${CHROOTDIR}
188fi
189
190if [ "x${RELSTRING}" = "x" ]; then
191 RELSTRING="$(chroot ${CHROOTDIR} uname -s)-${OSRELEASE}-${TARGET_ARCH}"
192fi
193
194chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} buildworld
195chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_KMAKEFLAGS} buildkernel
196chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \
197 release RELSTRING=${RELSTRING}
198chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \
199 install DESTDIR=/R RELSTRING=${RELSTRING}
200
201cd ${CHROOTDIR}/R
202
203sha256 FreeBSD-* > CHECKSUM.SHA256
204md5 FreeBSD-* > CHECKSUM.MD5
2#-
3# Copyright (c) 2013 Glen Barber
4# Copyright (c) 2011 Nathan Whitehorn
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
--- 15 unchanged lines hidden (view full) ---
24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26# SUCH DAMAGE.
27#
28# release.sh: check out source trees, and build release components with
29# totally clean, fresh trees.
30# Based on release/generate-release.sh written by Nathan Whitehorn
31#
32# $FreeBSD: head/release/release.sh 252101 2013-06-22 22:12:24Z gjb $
33#
34
35PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
36export PATH
37
38# The directory within which the release will be built.
39CHROOTDIR="/scratch"
40
41# The default svn checkout server, and svn branches for src/, doc/,
42# and ports/.
43SVNROOT="svn://svn.freebsd.org"
44SRCBRANCH="base/head"
45DOCBRANCH="doc/head"
46PORTBRANCH="ports/head"
47
48# The default src/, doc/, and ports/ revisions.
49SRCREVISION="-rHEAD"
50DOCREVISION="-rHEAD"
51PORTREVISION="-rHEAD"
52
53# The default make.conf and src.conf to use. Set to /dev/null
54# by default to avoid polluting the chroot(8) environment with
55# non-default settings.
--- 48 unchanged lines hidden (view full) ---
104 ;;
105 \?)
106 usage
107 ;;
108 esac
109done
110shift $(($OPTIND - 1))
111
112# The aggregated build-time flags based upon variables defined within
113# this file, unless overridden by release.conf. In most cases, these
114# will not need to be changed.
115CONF_FILES="__MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF}"
116ARCH_FLAGS="TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}"
117CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}"
118CHROOT_IMAKEFLAGS="${CONF_FILES}"
119CHROOT_DMAKEFLAGS="${CONF_FILES}"
120RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} ${CONF_FILES}"
121RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} KERNCONF=${KERNEL} ${ARCH_FLAGS} ${CONF_FILES}"
122RELEASE_RMAKEFLAGS="${ARCH_FLAGS} KERNCONF=${KERNEL} ${CONF_FILES} \
123 NODOC=${NODOC} NOPORTS=${NOPORTS}"
124
125# If PORTS is set and NODOC is unset, force NODOC=yes because the ports tree
126# is required to build the documentation set.
127if [ "x${NOPORTS}" != "x" ] && [ "x${NODOC}" = "x" ]; then
128 echo "*** NOTICE: Setting NODOC=1 since ports tree is required"
129 echo " and NOPORTS is set."
130 NODOC=1
131fi
132
133if [ ! ${CHROOTDIR} ]; then
134 echo "Please set CHROOTDIR."
135 exit 1
136fi
137
138if [ $(id -u) -ne 0 ]; then
139 echo "Needs to be run as root."
140 exit 1
141fi
142
143set -e # Everything must succeed
144
145mkdir -p ${CHROOTDIR}/usr
146
147svn co ${SVNROOT}/${SRCBRANCH} ${CHROOTDIR}/usr/src $SRCREVISION
148if [ "x${NODOC}" = "x" ]; then
149 svn co ${SVNROOT}/${DOCBRANCH} ${CHROOTDIR}/usr/doc $DOCREVISION
150fi
151if [ "x${NOPORTS}" = "x" ]; then
152 svn co ${SVNROOT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports $PORTREVISION
153fi
154
155get_rev_branch
156
157cd ${CHROOTDIR}/usr/src
158make ${CHROOT_WMAKEFLAGS} buildworld
159make ${CHROOT_IMAKEFLAGS} installworld DESTDIR=${CHROOTDIR}
160make ${CHROOT_DMAKEFLAGS} distribution DESTDIR=${CHROOTDIR}
161mount -t devfs devfs ${CHROOTDIR}/dev
162trap "umount ${CHROOTDIR}/dev" EXIT # Clean up devfs mount on exit
163
164build_doc_ports() {
165 ## Trick the ports 'run-autotools-fixup' target to do the right thing.
166 _OSVERSION=$(sysctl -n kern.osreldate)
167 if [ -d ${CHROOTDIR}/usr/doc ] && [ "x${NODOC}" != "x" ]; then
168 PBUILD_FLAGS="OSVERSION=${_OSVERSION} WITHOUT_JADETEX=yes BATCH=yes"
169 chroot ${CHROOTDIR} make -C /usr/ports/textproc/docproj \
170 ${PBUILD_FLAGS} install
171 fi
172}
173
174# If MAKE_CONF and/or SRC_CONF are set and not character devices (/dev/null),
175# copy them to the chroot.
176if [ -e ${MAKE_CONF} ] && [ ! -c ${MAKE_CONF} ]; then
177 mkdir -p ${CHROOTDIR}/$(dirname ${MAKE_CONF})
178 cp ${MAKE_CONF} ${CHROOTDIR}/${MAKE_CONF}
--- 7 unchanged lines hidden (view full) ---
186 cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf
187 build_doc_ports ${CHROOTDIR}
188fi
189
190if [ "x${RELSTRING}" = "x" ]; then
191 RELSTRING="$(chroot ${CHROOTDIR} uname -s)-${OSRELEASE}-${TARGET_ARCH}"
192fi
193
194chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} buildworld
195chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_KMAKEFLAGS} buildkernel
196chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \
197 release RELSTRING=${RELSTRING}
198chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \
199 install DESTDIR=/R RELSTRING=${RELSTRING}
200
201cd ${CHROOTDIR}/R
202
203sha256 FreeBSD-* > CHECKSUM.SHA256
204md5 FreeBSD-* > CHECKSUM.MD5