freebsd-dev/release/scripts/X11/build_x.sh
John Baldwin 5356254edb Overhaul this script a bit:
- build_x.sh now does all the steps to build an X dist rather than being
  a child script of package_x_dists.sh
- Update the usage information to list the ports you need to install
  before running this script as well as needing to set CVSROOT.
- Make sure CVSROOT is set.  If not, exit with an error.
- We now take two parameters: a work directory and an output directory.
  The work directory is used as scratch space.  All of the bindist will
  end up in the output directory.
- Only apply XF86.patch to the checked out XFree86 port if it exists.
- Use XFree86's build-bindist tool to package up the dists using their
  distfiles rather than using our own packing lists that have to be
  manually updated each time the port changes.

Example usage:
	env CVSROOT=/home/ncvs ./build_x.sh /usr/xtmp /usr/x11dists
2001-08-30 18:10:26 +00:00

152 lines
3.5 KiB
Bash
Executable File

#!/bin/sh
#
# This script builds X 3.3.x from the XFree86 and XFree86-contrib ports and
# installs it into a work directory. Once that is done, it uses XFree86's
# build-bindist command to package up the binary dists leaving them stored
# in the 'dist/bindist' subdirectory of the specified output directory.
# usage information
#
usage() {
echo "$0 <work dir> <output dir>"
echo
echo "Where <output dir> is the base directory to install X into,"
echo "and <work dir> is a scratch directory that the XFree86 ports"
echo "can be checked out into and built. This script also assumes"
echo "that it can get the distfiles from /usr/ports/distfiles (or"
echo "fetch them into that directory). The CVSROOT environment"
echo "variable should point to a FreeBSD CVS repository."
echo
echo "Before running this script, the following packages should be"
echo "installed:"
echo " XFree86"
echo " Tcl83, Tk83"
echo " ja-Tcl80, ja-Tk80"
echo
echo "Also, this should really be run as root."
exit 1
}
# check the command line
if [ $# -ne 2 ]; then
usage
fi
# check $CVSROOT
if [ -z "$CVSROOT" ]; then
echo "\$CVSROOT not set!"
echo
usage
fi
# setup the output directory
output_dir=$2
case $output_dir in
/*)
;;
*)
output_dir=`pwd`/${output_dir}
;;
esac
if [ -r ${output_dir} ]; then
if ! rm -rf ${output_dir}; then
echo "Could not remove ${output_dir}!"
echo
usage
fi
fi
if ! mkdir -p ${output_dir}; then
echo "Could not create ${output_dir}!"
echo
usage
fi
if ! rmdir ${output_dir}; then
echo "Could not remove ${output_dir} the second time!"
echo
usage
fi
# setup the work directory
work_dir=$1
if [ -r ${work_dir} ]; then
if ! rm -rf ${work_dir}; then
echo "Could not remove ${work_dir}!"
echo
usage
fi
fi
if ! mkdir -p ${work_dir}; then
echo "Could not create ${work_dir}!"
echo
usage
fi
if ! mkdir ${work_dir}/base; then
echo "Could not create ${work_dir}/base!"
echo
usage
fi
if ! mkdir ${work_dir}/dist; then
echo "Could not create ${work_dir}/dist!"
echo
usage
fi
if ! mkdir ${work_dir}/ports; then
echo "Could not create ${work_dir}/ports!"
echo
usage
fi
# check out the XFree86 and XFree86-contrib ports and set them up
if ! ( cd ${work_dir}/ports && \
cvs -R -d ${CVSROOT} co -P XFree86 XFree86-contrib ); then
echo "Could not checkout the XFree86 port!"
echo
usage
fi
if [ -r XF86.patch ]; then
if ! patch -d ${work_dir}/ports/XFree86 < XF86.patch; then
echo "Could not patch the XFree86 port!"
echo
usage
fi
fi
# actually build X
if ! ( cd ${work_dir}/ports/XFree86 && \
make BUILD_XDIST=yes DISTDIR=/usr/ports/distfiles \
DESTDIR=${work_dir}/base NO_PKG_REGISTER=yes all install ); then
echo "Could not build XFree86!"
echo
usage
fi
if ! ( cd ${work_dir}/ports/XFree86-contrib && \
make DISTDIR=/usr/ports/distfiles DESTDIR=${work_dir}/base \
NO_PKG_REGISTER=yes all install ); then
echo "Could not build XFree86-contrib!"
echo
usage
fi
# now package up the bindists
bindist_dir=${work_dir}/ports/XFree86/work/xc/programs/Xserver/hw/xfree86/etc/bindist
if ! cp ${bindist_dir}/FreeBSD-ELF/* ${work_dir}/dist; then
echo "Could not copy over distribution lists!"
echo
usage
fi
if ! cp ${bindist_dir}/common/* ${work_dir}/dist; then
echo "Could not copy over distribution lists!"
echo
usage
fi
if ! ${bindist_dir}/build-bindist X ${work_dir}/base ${work_dir}/dist; then
echo "Could not package up binary dists!"
echo
usage
fi
if ! mv ${work_dir}/dist/bindist ${output_dir}; then
echo "Could not move binary dists into ${output_dir}!"
echo
usage
fi