Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2013-12-06 12:04:52 +01:00
|
|
|
# $NetBSD: maketars,v 1.80 2013/02/07 16:27:41 christos Exp $
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
#
|
|
|
|
# Make release tar files for some or all lists. Usage:
|
|
|
|
# maketars [-b] [-x] [-i installdir] [-a arch] [-m machine] [-s setsdir]
|
|
|
|
# [-M metalog] [-N etcdir] [-d destdir] [-t tardir] [setname ...]
|
|
|
|
#
|
2013-12-06 12:04:52 +01:00
|
|
|
# The default sets are "base comp debug etc games man misc tests text"
|
|
|
|
# The X sets are "xbase xcomp xdebug xetc xfont xserver"
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
# The extsrc sets are "extbase extcomp extetc"
|
|
|
|
#
|
|
|
|
# If '-i installdir' is given, copy the given sets to installdir
|
|
|
|
# (using pax -rw ...) instead of creating tar files.
|
|
|
|
# In this case, remove "etc", "xetc", and "extetc" from the list of default sets.
|
|
|
|
#
|
|
|
|
|
|
|
|
prog="${0##*/}"
|
|
|
|
rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
|
|
|
|
. "${rundir}/sets.subr"
|
|
|
|
|
|
|
|
# set defaults
|
|
|
|
lists=
|
|
|
|
tars="${RELEASEDIR}"
|
|
|
|
dest="${DESTDIR}"
|
|
|
|
metalog=
|
|
|
|
installdir=
|
|
|
|
etcdir=
|
|
|
|
setfilesonly=false
|
|
|
|
quiet=false
|
2013-12-06 12:04:52 +01:00
|
|
|
skipkeys=time,md5,sha1,sha384,sha512,rmd160,cksum
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat 1>&2 <<USAGE
|
|
|
|
Usage: ${prog} [-L base,x,ext] [-b] [-x] [-y] [-i idir] [-a arch] [-m machine] [-s setsdir] [-S]
|
|
|
|
[-M metalog] [-N etcdir] [-d dest] [-t targetdir] [setname ...]
|
|
|
|
-L base,x,ext Make specified lists
|
|
|
|
-b Make both netbsd and x11 lists
|
|
|
|
-x Only make x11 lists
|
|
|
|
[Default: make netbsd lists]
|
|
|
|
-y Only make extsrc lists
|
|
|
|
[Default: make netbsd lists]
|
|
|
|
-i idir Install sets to idir instead of creating tar files
|
|
|
|
-a arch Set arch (e.g, m68k, mipseb, mipsel, powerpc) [${MACHINE_ARCH}]
|
|
|
|
-m machine Set machine (e.g, amiga, i386, macppc) [${MACHINE}]
|
|
|
|
-q Quiet operation
|
|
|
|
-s setsdir Directory to find sets [${setsdir}]
|
|
|
|
-S Exit after creating set files ${dest}/etc/mtree/set.*
|
|
|
|
-M metalog metalog file
|
|
|
|
-N etcdir etc dir for metalog use [${dest}/etc]
|
|
|
|
-d dest \${DESTDIR} [${dest}]
|
|
|
|
-t targetdir \${RELEASEDIR} [${tars}]
|
|
|
|
[setname ...] Sets to build [${lists}]
|
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
msg()
|
|
|
|
{
|
|
|
|
$quiet || echo $*
|
|
|
|
}
|
|
|
|
|
|
|
|
# handle args
|
|
|
|
while getopts L:bxyi:a:m:qs:SM:N:d:t: ch; do
|
|
|
|
case ${ch} in
|
|
|
|
L)
|
|
|
|
save_IFS="${IFS}"
|
|
|
|
IFS=,
|
|
|
|
for _list in ${OPTARG}; do
|
|
|
|
case $_list in
|
|
|
|
base) lists="${lists} ${nlists}" ;;
|
|
|
|
x) lists="${lists} ${xlists}" ;;
|
|
|
|
ext) lists="${lists} ${extlists}" ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
IFS="${save_IFS}"
|
|
|
|
;;
|
|
|
|
# backward compat
|
|
|
|
b)
|
|
|
|
lists="${nlists} ${xlists}"
|
|
|
|
;;
|
|
|
|
x)
|
|
|
|
lists="${xlists}"
|
|
|
|
;;
|
|
|
|
y)
|
|
|
|
lists="${extlists}"
|
|
|
|
;;
|
|
|
|
i)
|
|
|
|
installdir="${OPTARG}"
|
|
|
|
;;
|
|
|
|
a)
|
|
|
|
MACHINE_ARCH="${OPTARG}"
|
|
|
|
MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
|
|
|
|
;;
|
|
|
|
m)
|
|
|
|
MACHINE="${OPTARG}"
|
|
|
|
;;
|
|
|
|
q)
|
|
|
|
quiet=true
|
|
|
|
;;
|
|
|
|
s)
|
|
|
|
setsdir="${OPTARG}"
|
|
|
|
;;
|
|
|
|
S)
|
|
|
|
setfilesonly=true
|
|
|
|
;;
|
|
|
|
M)
|
|
|
|
metalog="${OPTARG}"
|
|
|
|
;;
|
|
|
|
N)
|
|
|
|
etcdir="${OPTARG}"
|
|
|
|
;;
|
|
|
|
d)
|
|
|
|
dest="${OPTARG}"
|
|
|
|
;;
|
|
|
|
t)
|
|
|
|
tars="${OPTARG}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((${OPTIND} - 1))
|
|
|
|
if [ -n "${installdir}" ]; then # if -i, remove etc + xetc + extetc from the default list
|
|
|
|
lists="$(echo ${lists} | ${SED} -e 's/ etc / /;s/ xetc / /;s/ extetc / /')"
|
|
|
|
fi
|
|
|
|
if [ -n "$*" ]; then
|
|
|
|
lists="$*"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${tars}" -a -z "${installdir}" ]; then
|
|
|
|
echo >&2 "${prog}: \${RELEASEDIR} must be set, or -i must be used"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${dest}" ]; then
|
|
|
|
echo >&2 "${prog}: \${DESTDIR} must be set"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
: ${etcdir:="${dest}/etc"}
|
|
|
|
|
|
|
|
SDIR="$(${MKTEMP} -d "/tmp/${prog}.XXXXXX")"
|
|
|
|
TMPFILES=
|
|
|
|
|
|
|
|
setlistdir="${dest}/etc/mtree"
|
|
|
|
|
|
|
|
cleanup()
|
|
|
|
{
|
|
|
|
es=$?
|
|
|
|
/bin/rm -rf "${SDIR}" ${TMPFILES}
|
|
|
|
trap - 0
|
|
|
|
exit ${es}
|
|
|
|
}
|
|
|
|
trap cleanup 0 2 3 13 # EXIT INT QUIT PIPE
|
|
|
|
|
|
|
|
#
|
|
|
|
# build the setfiles
|
|
|
|
#
|
|
|
|
|
|
|
|
for setname in ${lists}; do
|
|
|
|
${HOST_SH} "${setsdir}/makeflist" -a "${MACHINE_ARCH}" -m "${MACHINE}" \
|
|
|
|
-s "${setsdir}" "${setname}" > "${SDIR}/flist.${setname}" \
|
|
|
|
|| exit 1
|
|
|
|
if [ ! -s "${SDIR}/flist.${setname}" ]; then
|
|
|
|
echo >&2 "makeflist output is empty for ${setname}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-12-06 12:04:52 +01:00
|
|
|
${setfilesonly} && msg "Creating ${setlistdir}/set.${setname}"
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
if [ -n "${metalog}" ]; then
|
|
|
|
${AWK} -f "${rundir}/getdirs.awk" "${SDIR}/flist.${setname}" \
|
|
|
|
> "${SDIR}/flist.${setname}.full" \
|
|
|
|
|| exit 1
|
|
|
|
(
|
|
|
|
echo "/set uname=root gname=operator"
|
|
|
|
${AWK} -f "${rundir}/join.awk" \
|
|
|
|
"${SDIR}/flist.${setname}.full" "${metalog}"
|
|
|
|
echo "./etc/mtree/set.${setname} type=file mode=0444"
|
2013-12-06 12:04:52 +01:00
|
|
|
) | ${MTREE} -CS -k all -R "${skipkeys}" -N "${etcdir}" \
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
> "${setlistdir}/set.${setname}" \
|
|
|
|
|| exit 1
|
|
|
|
# We deliberately do not add set.${setname} to ${metalog},
|
|
|
|
# because we depend on it as an input.
|
2013-12-06 12:04:52 +01:00
|
|
|
else
|
|
|
|
${MTREE} -c -p "${dest}" -k all -R "${skipkeys}" \
|
|
|
|
-O "${SDIR}/flist.${setname}" | ${MTREE} -C -k all > \
|
|
|
|
"${setlistdir}/set.${setname}"
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
if ${setfilesonly}; then # exit after creating the set lists
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2013-12-06 12:04:52 +01:00
|
|
|
runpax() {
|
|
|
|
local s="$1"
|
|
|
|
shift
|
|
|
|
(cd "${dest}" &&
|
|
|
|
${PAX} -dOw -N"${etcdir}" -M "$@" < "${setlistdir}/set.${s}")
|
|
|
|
}
|
|
|
|
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
#
|
|
|
|
# now build the tarfiles
|
|
|
|
#
|
|
|
|
|
|
|
|
GZIP=-9n # for pax -z
|
|
|
|
export GZIP
|
|
|
|
es=0
|
|
|
|
for setname in ${lists:-${nlists}}; do
|
|
|
|
out="${setname}.tgz"
|
|
|
|
if [ -n "${installdir}" ]; then
|
|
|
|
msg "Copying set ${setname}"
|
2013-12-06 12:04:52 +01:00
|
|
|
runpax "${setname}" -rpe "${installdir}"
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
else
|
|
|
|
if [ -n "${metalog}" -a "${tars}/${out}" -nt "${metalog}" ]
|
|
|
|
then
|
|
|
|
msg "${out} is up to date"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
msg "Creating ${out}"
|
|
|
|
rm -f "${tars}/${out}"
|
|
|
|
TMPFILES="${TMPFILES} ${tars}/${out}.tmp"
|
2013-12-06 12:04:52 +01:00
|
|
|
runpax "${setname}" -z --use-compress-program \
|
|
|
|
${COMPRESS_PROGRAM} > "${tars}/${out}.tmp" &&
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
mv "${tars}/${out}.tmp" "${tars}/${out}"
|
|
|
|
fi
|
|
|
|
es=$((${es} + $?))
|
|
|
|
done
|
|
|
|
if [ ${es} -gt 255 ]; then
|
|
|
|
es=255
|
|
|
|
fi
|
|
|
|
exit ${es}
|