#!/bin/sh #DIR_VENDOR_DIST=mutt-1.2.5i #DIR_SRC=${DIR_VENDOR_DIST}-6 DIR_VENDOR_DIST=mutt-1.4 DIR_SRC=${DIR_VENDOR_DIST}-1 #DIR_VENDOR_DIST=mutt #DIR_SRC=${DIR_VENDOR_DIST} # Build directories DIR_OBJ=mutt-obj DIR_INST=mutt-install # Package names PACKAGENAME_VENDOR=${DIR_VENDOR_DIST} PACKAGENAME_BIN=${DIR_SRC} PACKAGENAME_SRC=${DIR_SRC}-src DIR_INST_DOC=/usr/doc/${PACKAGENAME_VENDOR} # Check to make sure we're running this script in one directory higher # than DIR_SRC: if ! test -d "${DIR_SRC}"; then echo "ERROR: This script must be run in the directory containing"; echo " the ${DIR_SRC} tree."; exit 1; fi ### Functions rmdir_ifexist() { if test -d $1; then if ! rm -rf $1; then return 1; fi; fi; return 0; } echo "Building ${DIR_SRC}" if (test -d ${DIR_OBJ} || test -d ${DIR_INST}); then # Build dirs exits, ask user if they want to wipe out everything and start over echo -n "Delete build dirs? [y/n]: " read DBD DBD=$(echo $DBD | tr [:upper:] [:lower:]); if [ "$DBD" = "y" ]; then if ! (rmdir_ifexist ${DIR_OBJ} && rmdir_ifexist ${DIR_INST}); then echo "ERROR: Couldn't remove OBJ and/or INSTALL dirs."; exit 1; fi fi else # No build dirs exist, so pretend the builder said "yes" DBD=y; fi if ! test -d $DIR_OBJ; then mkdir -p $DIR_OBJ; fi if ! test -d $DIR_INST; then mkdir -p $DIR_INST; fi export PREFIX=/usr export MAILPATH=/var/spool/mail OPTS="--with-mailpath=/var/spool/mail --with-regex --enable-pop --enable-imap --enable-locales-fix --with-ssl \ --enable-buffy-size \ --enable-external-dotlock \ --prefix=/usr \ --sysconfdir=/etc \ --libexecdir=\$(sbindir) \ --localstatedir=/var \ --datadir=\$(prefix)/share \ --with-docdir=${DIR_INST_DOC} \ " if false; then cd ${DIR_SRC} if aclocal -I m4 && autoheader && (cd m4 && make -f Makefile.am.in ) && automake -a -c && autoconf then echo echo "The mutt source code was successfully prepared." echo else echo echo "Some part of the preparation process failed." echo "Please refer to doc/devel-notes.txt for details." echo exit 1 fi cd .. fi if ! [ "$DBD" = "y" ]; then # Build directories have not been deleted, give the builder a choice of # whether to run configure or not echo -n "Run configure? [y/n]: " read DBD; else # Build directories are gone, we have no choice but to run configure DBD="y"; fi if [ "$DBD" = "y" ]; then # Change to build dir and configure cd ${DIR_OBJ} if ! ../${DIR_SRC}/configure ${OPTS}; then echo "ERROR: Configure failed."; exit 1; fi cd .. fi if ! make -C ${DIR_OBJ} CFLAGS="-I../${DIR_OBJ}"; then echo "ERROR: Make failed."; exit 1; fi export DESTDIR=$(pwd)/${DIR_INST} if ! make -C ${DIR_OBJ} -e install; then echo "ERROR: make install failed." exit 2; fi if true; then echo; echo "Creating distribution package..."; # Strip the binaries echo "Stripping binaries..." strip $(find ${DIR_INST} -iname '*.exe' -o -iname '*.dll') # Steal the pre-made HTML docs because I can't for the life of me get any # semblance of sgmltools to work right. echo "Copying HTML help files..." cp -p ${DIR_SRC}/doc/*.html ${DIR_INST}/${DIR_INST_DOC}/html # Remove any old distros that might be lying around rm ${DIR_INST}/${PACKAGENAME_SRC}.tar > /dev/null 2<&1 rm ${DIR_INST}/${PACKAGENAME_BIN}.tar > /dev/null 2<&1 rm ${DIR_INST}/${PACKAGENAME_SRC}.tar.bz2 > /dev/null 2<&1 rm ${DIR_INST}/${PACKAGENAME_BIN}.tar.bz2 > /dev/null 2<&1 # Generate a reverse diff that can be applied to revert the source back to # the original vendor distribution. echo "Generating reverse diff..." diff -Nrup ${DIR_VENDOR_DIST} ${DIR_SRC} > ${DIR_OBJ}/${PACKAGENAME_BIN}.patch # Move vendor docs to /usr/doc/${PACKAGENAME_VENDOR} echo "Moving vendor docs to Cygwin-specified location..." #mv ${DIR_INST}/usr/doc/mutt ${DIR_INST}/usr/doc/${PACKAGENAME_VENDOR} mkdir -p ${DIR_INST}/usr/doc/Cygwin cp -p ${DIR_SRC}/CYGWIN-PATCHES/${PACKAGENAME_BIN}.README ${DIR_INST}/usr/doc/Cygwin # Add this script to the src dist cp -up ./makemutt ${DIR_SRC}/CYGWIN-PATCHES/makemutt # Package it up cd ${DIR_INST} echo "Packaging binaries..." tar -cf ${PACKAGENAME_BIN}.tar * cd .. echo "Packaging source..." tar -cf ${DIR_INST}/${PACKAGENAME_SRC}.tar ${DIR_SRC} # Add reverse patch to src dist cd ${DIR_OBJ} tar --append -f ../${DIR_INST}/${PACKAGENAME_SRC}.tar ${PACKAGENAME_BIN}.patch cd .. # Compress the distros. Even if we didn't need to do this here, # and could use tar -cjf, this allows us to use -9 for better compression. echo "Compressing binary distribution..." bzip2 -9 ${DIR_INST}/${PACKAGENAME_BIN}.tar echo "Compressing source distribution..." bzip2 -9 ${DIR_INST}/${PACKAGENAME_SRC}.tar # Copy the setup.hint to the install dir. # Not sure why anymore, I think so the upload script can find it. cp -p ${DIR_SRC}/CYGWIN-PATCHES/setup.hint ${DIR_INST}/setup.hint fi; echo "Done."