3 # This script builds X 3.3.x from the XFree86 and XFree86-contrib ports and
4 # installs it into a work directory. Once that is done, it uses XFree86's
5 # build-bindist command to package up the binary dists leaving them stored
6 # in the 'dist/bindist' subdirectory of the specified output directory.
11 echo "$0 <work dir> <output dir>"
13 echo "Where <output dir> is the base directory to install X into,"
14 echo "and <work dir> is a scratch directory that the XFree86 ports"
15 echo "can be checked out into and built. This script also assumes"
16 echo "that it can get the distfiles from /usr/ports/distfiles (or"
17 echo "fetch them into that directory). The CVSROOT environment"
18 echo "variable should point to a FreeBSD CVS repository."
20 echo "Before running this script, the following packages should be"
24 echo " ja-Tcl80, ja-Tk80"
26 echo "Also, this should really be run as root."
30 # check the command line
36 if [ -z "$CVSROOT" ]; then
37 echo "\$CVSROOT not set!"
42 # setup the output directory
44 echo ">>> preparing output directory: ${output_dir}"
49 output_dir=`pwd`/${output_dir}
52 if [ -r ${output_dir} ]; then
53 if ! rm -rf ${output_dir}; then
54 echo "Could not remove ${output_dir}!"
59 if ! mkdir -p ${output_dir}; then
60 echo "Could not create ${output_dir}!"
64 if ! rmdir ${output_dir}; then
65 echo "Could not remove ${output_dir} the second time!"
70 # setup the work directory
72 echo ">>> preparing work directory: ${work_dir}"
73 if [ -r ${work_dir} ]; then
74 if ! rm -rf ${work_dir}; then
75 echo "Could not remove ${work_dir}!"
80 if ! mkdir -p ${work_dir}; then
81 echo "Could not create ${work_dir}!"
85 if ! mkdir ${work_dir}/base; then
86 echo "Could not create ${work_dir}/base!"
90 if ! mkdir ${work_dir}/dist; then
91 echo "Could not create ${work_dir}/dist!"
95 if ! mkdir ${work_dir}/ports; then
96 echo "Could not create ${work_dir}/ports!"
101 # check out the XFree86 and XFree86-contrib ports and set them up
102 echo ">>> checking out ports"
103 if ! ( cd ${work_dir}/ports && \
104 cvs -R -d ${CVSROOT} co -P XFree86 XFree86-contrib ); then
105 echo "Could not checkout the XFree86 port!"
109 if [ -r XF86.patch ]; then
110 echo ">>> patching ports"
111 if ! patch -d ${work_dir}/ports/XFree86 < XF86.patch; then
112 echo "Could not patch the XFree86 port!"
119 echo ">>> building X"
120 if ! ( cd ${work_dir}/ports/XFree86 && \
121 make BUILD_XDIST=yes DISTDIR=/usr/ports/distfiles \
122 DESTDIR=${work_dir}/base NO_PKG_REGISTER=yes all install ); then
123 echo "Could not build XFree86!"
127 if ! ( cd ${work_dir}/ports/XFree86-contrib && \
128 make DISTDIR=/usr/ports/distfiles DESTDIR=${work_dir}/base \
129 NO_PKG_REGISTER=yes all install ); then
130 echo "Could not build XFree86-contrib!"
135 # now package up the bindists
136 echo ">>> building bindist"
137 bindist_dir=${work_dir}/ports/XFree86/work/xc/programs/Xserver/hw/xfree86/etc/bindist
138 if ! cp ${bindist_dir}/FreeBSD-ELF/* ${work_dir}/dist; then
139 echo "Could not copy over distribution lists!"
143 if ! cp ${bindist_dir}/common/* ${work_dir}/dist; then
144 echo "Could not copy over distribution lists!"
148 if ! ${bindist_dir}/build-bindist X ${work_dir}/base ${work_dir}/dist; then
149 echo "Could not package up binary dists!"
153 if ! mv ${work_dir}/dist/bindist ${output_dir}; then
154 echo "Could not move binary dists into ${output_dir}!"