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 254293 2013-08-13 20:16:14Z 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@rHEAD" 45DOCBRANCH="doc/head@rHEAD" 46PORTBRANCH="ports/head@rHEAD" |
47 48# Sometimes one needs to checkout src with --force svn option. 49# If custom kernel configs copied to src tree before checkout, e.g. 50SRC_FORCE_CHECKOUT= 51 |
52# The default make.conf and src.conf to use. Set to /dev/null 53# by default to avoid polluting the chroot(8) environment with 54# non-default settings. 55MAKE_CONF="/dev/null" 56SRC_CONF="/dev/null" 57 58# The number of make(1) jobs, defaults to the number of CPUs available for 59# buildworld, and half of number of CPUs available for buildkernel. |
60NCPU=$(sysctl -n hw.ncpu) 61if [ ${NCPU} -gt 1 ]; then 62 WORLD_FLAGS="-j${NCPU}" 63 KERNEL_FLAGS="-j$(expr ${NCPU} / 2)" 64fi |
65MAKE_FLAGS="-s" 66 67# The name of the kernel to build, defaults to GENERIC. 68KERNEL="GENERIC" 69 |
70# Set to non-empty value to disable checkout of doc/ and/or ports/. Disabling 71# ports/ checkout also forces NODOC to be set. 72NODOC= 73NOPORTS= 74MAKE_FLAGS="${MAKE_FLAGS}" 75 76get_rev_branch () { 77 # Set up the OSVERSION, BRANCH, and REVISION based on the src/ tree --- 47 unchanged lines hidden (view full) --- 125if [ "x${NODOC}" != "x" ]; then 126 DOCPORTS="${DOCPORTS}NODOC=yes" 127fi 128 129# The aggregated build-time flags based upon variables defined within 130# this file, unless overridden by release.conf. In most cases, these 131# will not need to be changed. 132CONF_FILES="__MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF}" |
133if [ "x${TARGET}" != "x" ] && [ "x${TARGET_ARCH}" != "x" ]; then 134 ARCH_FLAGS="TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" 135else 136 ARCH_FLAGS= 137fi |
138CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}" 139CHROOT_IMAKEFLAGS="${CONF_FILES}" 140CHROOT_DMAKEFLAGS="${CONF_FILES}" 141RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} ${CONF_FILES}" 142RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} KERNCONF=\"${KERNEL}\" ${ARCH_FLAGS} ${CONF_FILES}" 143RELEASE_RMAKEFLAGS="${ARCH_FLAGS} KERNCONF=\"${KERNEL}\" ${CONF_FILES} \ 144 ${DOCPORTS}" 145 --- 12 unchanged lines hidden (view full) --- 158 echo "Needs to be run as root." 159 exit 1 160fi 161 162set -e # Everything must succeed 163 164mkdir -p ${CHROOTDIR}/usr 165 |
166svn co ${FORCE_SRC_KEY} ${SVNROOT}/${SRCBRANCH} ${CHROOTDIR}/usr/src |
167if [ "x${NODOC}" = "x" ]; then |
168 svn co ${SVNROOT}/${DOCBRANCH} ${CHROOTDIR}/usr/doc |
169fi 170if [ "x${NOPORTS}" = "x" ]; then |
171 svn co ${SVNROOT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports |
172fi 173 174get_rev_branch 175 176cd ${CHROOTDIR}/usr/src 177make ${CHROOT_WMAKEFLAGS} buildworld 178make ${CHROOT_IMAKEFLAGS} installworld DESTDIR=${CHROOTDIR} 179make ${CHROOT_DMAKEFLAGS} distribution DESTDIR=${CHROOTDIR} --- 44 unchanged lines hidden --- |