2009-03-16 17:47:07 +00:00
|
|
|
HOST_SYSTEM=`uname -s | tr [:upper:] [:lower:] | sed s/darwin/macosx/`
|
|
|
|
|
|
|
|
if [ "${HOST_SYSTEM}" = "macosx" ]; then
|
|
|
|
HOST_MACHINE=`uname -p | tr [:upper:] [:lower:]`
|
|
|
|
else
|
|
|
|
HOST_MACHINE=`uname -m | tr [:upper:] [:lower:] | sed s/i686/i386/ | sed s/x86_64/amd64/ | sed s/ppc64/powerpc/`
|
|
|
|
fi
|
|
|
|
|
2009-03-23 21:36:45 +00:00
|
|
|
BINSUFFIX=
|
2009-03-23 21:47:08 +00:00
|
|
|
MAKEARGS=
|
|
|
|
MAKE=make
|
|
|
|
WANTZIP=0
|
2009-03-23 21:36:45 +00:00
|
|
|
|
2009-03-16 17:47:07 +00:00
|
|
|
if [ "${HOST_SYSTEM}" = "mingw32_nt-5.1" ]; then
|
|
|
|
HOST_SYSTEM=win32
|
2009-03-23 21:36:45 +00:00
|
|
|
BINSUFFIX=.exe
|
2009-03-16 18:02:47 +00:00
|
|
|
WANTZIP=1
|
2009-03-23 21:47:08 +00:00
|
|
|
MAKEARGS="USE_BIGENDIAN=NO"
|
2009-03-16 17:47:07 +00:00
|
|
|
fi
|
|
|
|
|
2009-03-23 21:36:45 +00:00
|
|
|
BINARY=uhub${BINSUFFIX}
|
|
|
|
|
|
|
|
if [ "${HOST_SYSTEM}" = "FreeBSD" ]; then
|
|
|
|
MAKE=gmake
|
|
|
|
fi
|
2009-03-16 18:02:47 +00:00
|
|
|
|
2009-03-16 17:47:07 +00:00
|
|
|
VERSION=`grep define\ VERSION version.h | cut -f 3 -d " " | tr -d [=\"=]`
|
|
|
|
SNAPSHOT=`date '+%Y%m%d'`
|
|
|
|
PACKAGE=uhub-${VERSION}
|
|
|
|
PACKAGE_SRC=${PACKAGE}-src
|
|
|
|
PACKAGE_BIN=${PACKAGE}-${HOST_SYSTEM}-${HOST_MACHINE}
|
2009-03-23 22:30:51 +00:00
|
|
|
ARCHIVE='build-archive:~/www/downloads/uhub/'
|
2009-03-16 17:47:07 +00:00
|
|
|
|
2009-03-16 21:49:55 +00:00
|
|
|
function export_source_directory
|
|
|
|
{
|
2009-03-16 17:47:07 +00:00
|
|
|
if [ -d ${PACKAGE} ]; then
|
|
|
|
rm -Rf ${PACKAGE};
|
|
|
|
fi
|
2009-03-16 18:02:47 +00:00
|
|
|
|
|
|
|
if [ ! -d .git ]; then
|
|
|
|
echo "No git repo found in `dirname $0`"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-03-16 21:49:55 +00:00
|
|
|
git archive --format=tar --prefix=${PACKAGE}/ HEAD > tmp.tar && tar -xf tmp.tar && rm tmp.tar
|
2009-03-16 18:02:47 +00:00
|
|
|
|
|
|
|
if [ ! -d ${PACKAGE} ]; then
|
|
|
|
echo "Something went wrong while exporting the repo."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2009-03-16 21:49:55 +00:00
|
|
|
function package_zips
|
2009-03-16 18:02:47 +00:00
|
|
|
{
|
|
|
|
tar cf $1.tar $2
|
|
|
|
gzip -c -9 $1.tar > $1.tar.gz
|
|
|
|
bzip2 -c -9 $1.tar > $1.tar.bz2
|
|
|
|
rm -f $1.tar
|
2009-03-23 21:47:08 +00:00
|
|
|
|
2009-03-23 21:36:45 +00:00
|
|
|
if [ $WANTZIP -eq 1 ]; then
|
|
|
|
zip -q -9 -r $1.zip $2
|
|
|
|
fi
|
2009-03-16 17:47:07 +00:00
|
|
|
}
|
|
|
|
|
2009-03-16 21:49:55 +00:00
|
|
|
function export_sources
|
2009-03-16 17:47:07 +00:00
|
|
|
{
|
2009-03-23 21:36:45 +00:00
|
|
|
if [ ! -d ${PACKAGE} ]; then
|
|
|
|
export_source_directory
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd ${PACKAGE}
|
2009-03-23 21:47:08 +00:00
|
|
|
${MAKE} ${MAKEARGS} autotest.c
|
2009-03-23 21:36:45 +00:00
|
|
|
cd ..
|
2009-03-23 21:40:15 +00:00
|
|
|
|
2009-03-23 21:47:08 +00:00
|
|
|
if [ ! -f ${PACKAGE}/autotest.c ]; then
|
2009-03-23 21:40:15 +00:00
|
|
|
echo "Unable to create autotest.c, aborting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-03-23 21:36:45 +00:00
|
|
|
rm -Rf ${PACKAGE}/admin
|
2009-03-16 18:02:47 +00:00
|
|
|
package_zips ${PACKAGE_SRC} ${PACKAGE}
|
|
|
|
|
|
|
|
rm -Rf ${PACKAGE};
|
2009-03-16 17:47:07 +00:00
|
|
|
cp ChangeLog ChangeLog-${VERSION}
|
|
|
|
}
|
|
|
|
|
2009-03-16 21:49:55 +00:00
|
|
|
function export_binaries
|
2009-03-16 17:47:07 +00:00
|
|
|
{
|
2009-03-23 21:36:45 +00:00
|
|
|
if [ ! -d ${PACKAGE} ]; then
|
|
|
|
export_source_directory
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd ${PACKAGE}
|
2009-03-23 21:47:08 +00:00
|
|
|
${MAKE} ${MAKEARGS} RELEASE=YES
|
2009-03-23 21:40:15 +00:00
|
|
|
cd ..
|
2009-03-23 21:36:45 +00:00
|
|
|
|
2009-03-23 21:40:15 +00:00
|
|
|
if [ ! -x ${PACKAGE}/${BINARY} ]; then
|
2009-03-23 21:36:45 +00:00
|
|
|
echo "Packaging failed, no binary found..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-03-16 17:47:07 +00:00
|
|
|
rm -Rf ${PACKAGE}/admin
|
|
|
|
rm -Rf ${PACKAGE}/autotest
|
|
|
|
rm -Rf ${PACKAGE}/src
|
2009-03-23 21:36:45 +00:00
|
|
|
rm -Rf ${PACKAGE}/debian
|
2009-03-16 17:47:07 +00:00
|
|
|
rm -f ${PACKAGE}/autotest.c
|
|
|
|
rm -f ${PACKAGE}/*akefile
|
|
|
|
rm -f ${PACKAGE}/version.h
|
|
|
|
rm -f ${PACKAGE}/doc/Doxyfile
|
|
|
|
rm -f ${PACKAGE}/doc/uhub.dot
|
2009-03-23 21:36:45 +00:00
|
|
|
rm -f ${PACKAGE}/libuhub*
|
2009-03-16 17:47:07 +00:00
|
|
|
|
2009-03-16 18:02:47 +00:00
|
|
|
package_zips ${PACKAGE_BIN} ${PACKAGE}
|
|
|
|
|
|
|
|
rm -Rf ${PACKAGE};
|
2009-03-16 17:47:07 +00:00
|
|
|
}
|
|
|
|
|
2009-03-23 22:02:59 +00:00
|
|
|
function upload_pkg
|
|
|
|
{
|
|
|
|
if [ -f $1 ]; then
|
|
|
|
echo scp $1 ${URL_ARCHIVE}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function upload_packages
|
|
|
|
{
|
|
|
|
upload_pkg ${PACKAGE_SRC}.tar.gz
|
|
|
|
upload_pkg ${PACKAGE_SRC}.tar.bz2
|
|
|
|
upload_pkg ${PACKAGE_SRC}.zip
|
|
|
|
upload_pkg ChangeLog-${VERSION}
|
|
|
|
upload_pkg ${PACKAGE_BIN}.tar.gz
|
|
|
|
upload_pkg ${PACKAGE_BIN}.tar.bz2
|
|
|
|
upload_pkg ${PACKAGE_BIN}.zip
|
|
|
|
}
|
|
|
|
|
2009-03-16 17:47:07 +00:00
|
|
|
|