Project

General

Profile

« Previous | Next » 

Revision 64f27203

Added by Renato Botelho almost 10 years ago

Rename SRCDIR to FREEBSD_SRC_DIR and change default value to SCRATCHDIR/FreeBSD-src to make build process less intrusive

View differences:

tools/builder_common.sh
231 231
		unset KERNEL_NAME
232 232
		export KERNCONF=$BUILD_KERNEL
233 233
		export KERNEL_DESTDIR="$KERNEL_BUILD_PATH/$BUILD_KERNEL"
234
		export KERNELCONF="$SRCDIR/sys/${TARGET}/conf/$BUILD_KERNEL"
234
		export KERNELCONF="${FREEBSD_SRC_DIR}/sys/${TARGET}/conf/$BUILD_KERNEL"
235 235
		export KERNEL_NAME=${BUILD_KERNEL}
236 236

  
237 237
		LOGFILE="${BUILDER_LOGS}/kernel.${KERNCONF}.${TARGET}.log"
238 238
		echo ">>> Building $BUILD_KERNEL kernel."  | tee -a ${LOGFILE}
239 239

  
240
		if [ ! -e "${SRCDIR}/sys/${TARGET}/conf/${BUILD_KERNEL}" ]; then
240
		if [ ! -e "${FREEBSD_SRC_DIR}/sys/${TARGET}/conf/${BUILD_KERNEL}" ]; then
241 241
			echo ">>> ERROR: Could not find $KERNELCONF"
242 242
			print_error_pfS
243 243
		fi
......
373 373
	printf "                   Stage DIR: %s\n" $STAGE_CHROOT_DIR
374 374
	printf "                 Updates dir: %s\n" $UPDATESDIR
375 375
	printf " Image Preparation Stage DIR: %s\n" $FINAL_CHROOT_DIR
376
	printf "                  Source DIR: %s\n" $SRCDIR
376
	printf "                  Source DIR: %s\n" $FREEBSD_SRC_DIR
377 377
	printf "          FreeBSD repository: %s\n" $FREEBSD_REPO_BASE
378 378
	printf "          FreeBSD-src branch: %s\n" $FREEBSD_BRANCH
379 379
	printf "     FreeBSD original branch: %s\n" $FREEBSD_PARENT_BRANCH
......
422 422
	echo ">>> LOGFILE set to $LOGFILE." | tee -a ${LOGFILE}
423 423
	makeargs="${MAKE_ARGS}"
424 424
	echo ">>> Building world for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE}
425
	echo ">>> Builder is running the command: env LOCAL_ITOOLS=\"${EXTRA_TOOLS}\" script -aq $LOGFILE make -C ${SRCDIR} -DNO_CLEAN ${makeargs:-} buildworld" | tee -a ${LOGFILE}
426
	(env LOCAL_ITOOLS="${EXTRA_TOOLS}" script -aq $LOGFILE make -C ${SRCDIR} -DNO_CLEAN ${makeargs:-} buildworld || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
425
	echo ">>> Builder is running the command: env LOCAL_ITOOLS=\"${EXTRA_TOOLS}\" script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} -DNO_CLEAN ${makeargs:-} buildworld" | tee -a ${LOGFILE}
426
	(env LOCAL_ITOOLS="${EXTRA_TOOLS}" script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} -DNO_CLEAN ${makeargs:-} buildworld || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
427 427
	echo ">>> Building world for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE}
428 428

  
429 429
	LOGFILE=${BUILDER_LOGS}/installworld.${TARGET}
......
432 432
	mkdir -p ${STAGE_CHROOT_DIR}
433 433
	makeargs="${MAKE_ARGS} DESTDIR=${STAGE_CHROOT_DIR} WITHOUT_TOOLCHAIN=1"
434 434
	echo ">>> Installing world for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE}
435
	echo ">>> Builder is running the command: env LOCAL_ITOOLS=\"${EXTRA_TOOLS}\" script -aq $LOGFILE make -C ${SRCDIR} ${makeargs:-} installworld" | tee -a ${LOGFILE}
436
	(env LOCAL_ITOOLS="${EXTRA_TOOLS}" script -aq $LOGFILE make -C ${SRCDIR} ${makeargs:-} installworld || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
435
	echo ">>> Builder is running the command: env LOCAL_ITOOLS=\"${EXTRA_TOOLS}\" script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs:-} installworld" | tee -a ${LOGFILE}
436
	(env LOCAL_ITOOLS="${EXTRA_TOOLS}" script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs:-} installworld || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
437 437
	echo ">>> Installing world for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE}
438 438

  
439 439
	makeargs="${MAKE_ARGS} DESTDIR=${STAGE_CHROOT_DIR}"
440 440
	echo ">>> Distribution world for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE}
441
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${SRCDIR} ${makeargs:-} distribution " | tee -a ${LOGFILE}
442
	(script -aq $LOGFILE make -C ${SRCDIR} ${makeargs:-} distribution  || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
441
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs:-} distribution " | tee -a ${LOGFILE}
442
	(script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs:-} distribution  || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
443 443
	echo ">>> Distribution world for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE}
444 444

  
445 445
	[ -d "${STAGE_CHROOT_DIR}/usr/local/bin" ] \
446 446
		|| mkdir -p ${STAGE_CHROOT_DIR}/usr/local/bin
447 447
	makeargs="${MAKE_ARGS} DESTDIR=${STAGE_CHROOT_DIR}"
448 448
	echo ">>> Building and installing crypto tools and athstats for ${TARGET} architecture... (Starting - $(LC_ALL=C date))" | tee -a ${LOGFILE}
449
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${SRCDIR}/tools/tools/crypto ${makeargs:-} clean all install " | tee -a ${LOGFILE}
450
	(script -aq $LOGFILE make -C ${SRCDIR}/tools/tools/crypto ${makeargs:-} clean all install || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
451
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${SRCDIR}/tools/tools/ath/athstats ${makeargs:-} clean" | tee -a ${LOGFILE}
452
	(script -aq $LOGFILE make -C ${SRCDIR}/tools/tools/ath/athstats ${makeargs:-} clean || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
453
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${SRCDIR}/tools/tools/ath/athstats ${makeargs:-} all" | tee -a ${LOGFILE}
454
	(script -aq $LOGFILE make -C ${SRCDIR}/tools/tools/ath/athstats ${makeargs:-} all || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
455
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${SRCDIR}/tools/tools/ath/athstats ${makeargs:-} install" | tee -a ${LOGFILE}
456
	(script -aq $LOGFILE make -C ${SRCDIR}/tools/tools/ath/athstats ${makeargs:-} install || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
449
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/crypto ${makeargs:-} clean all install " | tee -a ${LOGFILE}
450
	(script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/crypto ${makeargs:-} clean all install || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
451
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/ath/athstats ${makeargs:-} clean" | tee -a ${LOGFILE}
452
	(script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/ath/athstats ${makeargs:-} clean || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
453
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/ath/athstats ${makeargs:-} all" | tee -a ${LOGFILE}
454
	(script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/ath/athstats ${makeargs:-} all || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
455
	echo ">>> Builder is running the command: script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/ath/athstats ${makeargs:-} install" | tee -a ${LOGFILE}
456
	(script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR}/tools/tools/ath/athstats ${makeargs:-} install || print_error_pfS;) | egrep '^>>>' | tee -a ${LOGFILE}
457 457
	echo ">>> Building and installing crypto tools and athstats for ${TARGET} architecture... (Finished - $(LC_ALL=C date))" | tee -a ${LOGFILE}
458 458

  
459 459
	unset makeargs
......
1018 1018
	fi
1019 1019
	mkdir -p ${STAGE_CHROOT_DIR}
1020 1020

  
1021
	if [ -z "${NO_CLEANFREEBSDOBJDIR}" -a -d "${SRCDIR}" ]; then
1022
		OBJTREE=$(env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} make -C ${SRCDIR} -V OBJTREE)
1021
	if [ -z "${NO_CLEANFREEBSDOBJDIR}" -a -d "${FREEBSD_SRC_DIR}" ]; then
1022
		OBJTREE=$(env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} make -C ${FREEBSD_SRC_DIR} -V OBJTREE)
1023 1023
		if [ -d "${OBJTREE}" ]; then
1024 1024
			echo -n ">>> Cleaning FreeBSD objects dir staging..."
1025 1025
			echo -n "."
......
1041 1041
	echo "Done!"
1042 1042

  
1043 1043
	if [ -z "${NO_CLEANREPOS}" ]; then
1044
		if [ -d "$SRCDIR" ]; then
1045
			echo -n ">>> Ensuring $SRCDIR is clean..."
1046
			rm -rf ${SRCDIR}
1044
		if [ -d "$FREEBSD_SRC_DIR" ]; then
1045
			echo -n ">>> Ensuring $FREEBSD_SRC_DIR is clean..."
1046
			rm -rf ${FREEBSD_SRC_DIR}
1047 1047
			echo "Done!"
1048 1048
		fi
1049 1049
	fi
......
1059 1059
	echo ">>> Cleaning of builder environment has finished."
1060 1060
}
1061 1061

  
1062
# This routine ensures that the $SRCDIR has sources
1062
# This routine ensures that the $FREEBSD_SRC_DIR has sources
1063 1063
# and is ready for action / building.
1064 1064
ensure_source_directories_present() {
1065 1065
	update_freebsd_sources
......
1427 1427
		-e "s/%%GIT_REPO_BRANCH_OR_TAG%%/${_branch}/g" \
1428 1428
		-e "s,%%PKG_REPO_SERVER%%,${PKG_REPO_SERVER},g" \
1429 1429
		-e "s/%%PRODUCT_NAME%%/${PRODUCT_NAME}/g" \
1430
		${SRCDIR}/release/pkg_repos/${PRODUCT_NAME}.conf.template \
1430
		${FREEBSD_SRC_DIR}/release/pkg_repos/${PRODUCT_NAME}.conf.template \
1431 1431
		> ${_target}
1432 1432
}
1433 1433

  
......
1460 1460
		local _clone_params="--depth 1 --single-branch"
1461 1461
	fi
1462 1462

  
1463
	if [ ! -d "${SRCDIR}" ]; then
1464
		mkdir -p ${SRCDIR}
1463
	if [ ! -d "${FREEBSD_SRC_DIR}" ]; then
1464
		mkdir -p ${FREEBSD_SRC_DIR}
1465 1465
	fi
1466 1466

  
1467 1467
	if [ -n "${NO_BUILDWORLD:-}" -a -n "${NO_BUILDKERNEL:-}" ]; then
......
1473 1473
	local _FREEBSD_BRANCH=${FREEBSD_BRANCH:-"devel"}
1474 1474
	local _CLONE=1
1475 1475

  
1476
	if [ -d "${SRCDIR}/.git" ]; then
1477
		CUR_BRANCH=$(cd ${SRCDIR} && git branch | grep '^\*' | cut -d' ' -f2)
1476
	if [ -d "${FREEBSD_SRC_DIR}/.git" ]; then
1477
		CUR_BRANCH=$(cd ${FREEBSD_SRC_DIR} && git branch | grep '^\*' | cut -d' ' -f2)
1478 1478
		if [ ${_full} -eq 0 -a "${CUR_BRANCH}" = "${_FREEBSD_BRANCH}" ]; then
1479 1479
			_CLONE=0
1480
			( cd ${SRCDIR} && git clean -fxd; git fetch origin; git reset --hard origin/${_FREEBSD_BRANCH} ) 2>&1 | grep -C3 -i -E 'error|fatal'
1480
			( cd ${FREEBSD_SRC_DIR} && git clean -fxd; git fetch origin; git reset --hard origin/${_FREEBSD_BRANCH} ) 2>&1 | grep -C3 -i -E 'error|fatal'
1481 1481
		else
1482
			rm -rf ${SRCDIR}
1482
			rm -rf ${FREEBSD_SRC_DIR}
1483 1483
		fi
1484 1484
	fi
1485 1485

  
1486 1486
	if [ ${_CLONE} -eq 1 ]; then
1487
		( git clone --branch ${_FREEBSD_BRANCH} ${_clone_params} ${FREEBSD_REPO_BASE} ${SRCDIR} ) 2>&1 | grep -C3 -i -E 'error|fatal'
1487
		( git clone --branch ${_FREEBSD_BRANCH} ${_clone_params} ${FREEBSD_REPO_BASE} ${FREEBSD_SRC_DIR} ) 2>&1 | grep -C3 -i -E 'error|fatal'
1488 1488
	fi
1489 1489

  
1490
	if [ ! -d "${SRCDIR}/.git" ]; then
1490
	if [ ! -d "${FREEBSD_SRC_DIR}/.git" ]; then
1491 1491
		echo ">>> ERROR: It was not possible to clone FreeBSD src repo"
1492 1492
		print_error_pfS
1493 1493
	fi
1494 1494

  
1495 1495
	if [ -n "${GIT_FREEBSD_COSHA1}" ]; then
1496
		( cd ${SRCDIR} && git checkout ${GIT_FREEBSD_COSHA1} ) 2>&1 | grep -C3 -i -E 'error|fatal'
1496
		( cd ${FREEBSD_SRC_DIR} && git checkout ${GIT_FREEBSD_COSHA1} ) 2>&1 | grep -C3 -i -E 'error|fatal'
1497 1497
	fi
1498 1498
	echo "Done!"
1499 1499
}
......
1622 1622

  
1623 1623
	makeargs="${MAKEJ_KERNEL:-} SRCCONF=${SRC_CONF} __MAKE_CONF=${MAKE_CONF} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}"
1624 1624
	echo ">>> Builder is running the command: script -aq $LOGFILE make -DNO_KERNELCLEAN $makeargs buildkernel KERNCONF=${KERNCONF}" | tee -a $LOGFILE
1625
	(script -q $LOGFILE make -C ${SRCDIR} -DNO_KERNELCLEAN $makeargs buildkernel KERNCONF=${KERNCONF} || print_error_pfS;) | egrep '^>>>'
1625
	(script -q $LOGFILE make -C ${FREEBSD_SRC_DIR} -DNO_KERNELCLEAN $makeargs buildkernel KERNCONF=${KERNCONF} || print_error_pfS;) | egrep '^>>>'
1626 1626
}
1627 1627

  
1628 1628
# Imported from FreeSBIE
......
1640 1640
	mkdir -p ${STAGE_CHROOT_DIR}/boot
1641 1641
	makeargs="${MAKEJ_KERNEL:-} SRCCONF=${SRC_CONF} __MAKE_CONF=${MAKE_CONF} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} DESTDIR=${KERNEL_DESTDIR}"
1642 1642
	echo ">>> Builder is running the command: script -aq $LOGFILE make ${makeargs:-} installkernel KERNCONF=${KERNCONF}"  | tee -a $LOGFILE
1643
	(script -aq $LOGFILE make -C ${SRCDIR} ${makeargs:-} installkernel KERNCONF=${KERNCONF} || print_error_pfS;) | egrep '^>>>'
1643
	(script -aq $LOGFILE make -C ${FREEBSD_SRC_DIR} ${makeargs:-} installkernel KERNCONF=${KERNCONF} || print_error_pfS;) | egrep '^>>>'
1644 1644
	gzip -f9 $KERNEL_DESTDIR/boot/kernel/kernel
1645 1645
}
1646 1646

  
......
1682 1682

  
1683 1683
	# Create a big patch with all our changes to use on jail
1684 1684
	( \
1685
		cd ${SRCDIR} && \
1685
		cd ${FREEBSD_SRC_DIR} && \
1686 1686
		git diff $(git merge-base origin/${FREEBSD_PARENT_BRANCH} ${FREEBSD_BRANCH}) > ${_jail_patch}
1687 1687
	) >/dev/null 2>&1
1688 1688

  
tools/builder_defaults.sh
95 95
export FREEBSD_REPO_BASE=${FREEBSD_REPO_BASE:-"git@git.pfmechanics.com:pfsense/freebsd-src.git"}
96 96
export FREEBSD_BRANCH=${FREEBSD_BRANCH:-"devel"}
97 97
export FREEBSD_PARENT_BRANCH=${FREEBSD_PARENT_BRANCH:-"stable/10"}
98
export FREEBSD_SRC_DIR=${FREEBSD_SRC_DIR:-"${SCRATCHDIR}/FreeBSD-src"}
98 99

  
99 100
# Product details
100 101
export PRODUCT_NAME=${PRODUCT_NAME:-"pfSense"}
......
149 150
# iso staging area.
150 151
export FINAL_CHROOT_DIR=${FINAL_CHROOT_DIR:-"${SCRATCHDIR}/final-dir"}
151 152

  
152
export SRCDIR=${SRCDIR:-"/usr/${PRODUCT_NAME}src/src.${GIT_REPO_BRANCH_OR_TAG}"}
153

  
154 153
# 400M is not enough for amd64
155 154
export MEMORYDISK_SIZE=${MEMORYDISK_SIZE:-"768M"}
156 155

  
......
176 175
# end of OVF
177 176

  
178 177
# Leave this alone.
179
export SRC_CONF=${SRC_CONF:-"${SRCDIR}/release/conf/${PRODUCT_NAME}_src.conf"}
180
export MAKE_CONF=${MAKE_CONF:-"${SRCDIR}/release/conf/${PRODUCT_NAME}_make.conf"}
178
export SRC_CONF=${SRC_CONF:-"${FREEBSD_SRC_DIR}/release/conf/${PRODUCT_NAME}_src.conf"}
179
export MAKE_CONF=${MAKE_CONF:-"${FREEBSD_SRC_DIR}/release/conf/${PRODUCT_NAME}_make.conf"}
181 180

  
182 181
# Extra tools to be added to ITOOLS
183 182
export EXTRA_TOOLS=${EXTRA_TOOLS:-"uuencode uudecode ex"}

Also available in: Unified diff