mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 00:28:23 +01:00
working on build scripts
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@4359 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
9ccd968af4
commit
8b2adcac67
127
build/Makefile
Normal file
127
build/Makefile
Normal file
@ -0,0 +1,127 @@
|
||||
# $Id: Makefile 4077 2010-02-18 04:05:37Z charlton $
|
||||
|
||||
#
|
||||
# To run step by step
|
||||
# 1. make source
|
||||
# 2. make script
|
||||
# 3. make build_all
|
||||
# and step 3 may be broken using the following
|
||||
# 3a. make prep
|
||||
# 3b. make conf
|
||||
# 3c. make build
|
||||
# 3d. make install
|
||||
# 3e. make pkg
|
||||
# 3f. make spkg
|
||||
# 3g. make finish
|
||||
#
|
||||
|
||||
NAME := IPhreeqc
|
||||
|
||||
FORCE_UPDATE := $(shell svn up ..)
|
||||
|
||||
RELEASE ?= $(shell svn st -v dist.sh | cut -b 10- | ( read one two ; echo $$one ) )
|
||||
|
||||
ifneq ($(strip $(DATE)),)
|
||||
DATE_STAMP := $(shell date -d $(DATE) "+%m-%d-%Y")
|
||||
TOUCH_STAMP := $(shell date -d $(DATE) "+%Y%m%d0000")
|
||||
endif
|
||||
|
||||
TARBALL := $(NAME)-$(VERSION)-$(RELEASE).tar.gz
|
||||
|
||||
BUILD_SCRIPT := $(NAME)-$(VERSION)-$(RELEASE).sh
|
||||
|
||||
REPOS_PATH ?= trunk
|
||||
|
||||
# (ie IPhreeqc-0.1-584-src.tar.bz2)
|
||||
SRC_PACKAGE := $(NAME)-$(VERSION)-$(RELEASE)-src.tar.bz2
|
||||
|
||||
# (ie IPhreeqc-0.1-584.tar.bz2)
|
||||
BIN_PACKAGE := $(NAME)-$(VERSION)-$(RELEASE).tar.bz2
|
||||
|
||||
all : check_args $(BIN_PACKAGE)
|
||||
echo $(VERSION) > VERSION
|
||||
|
||||
build_all : check_args $(BIN_PACKAGE)
|
||||
|
||||
prep : check_args source script
|
||||
time ./$(BUILD_SCRIPT) prep 2>&1 | tee prep-$(RELEASE).log
|
||||
|
||||
conf : check_args source script
|
||||
time ./$(BUILD_SCRIPT) conf 2>&1 | tee conf-$(RELEASE).log
|
||||
|
||||
reconf : check_args source script
|
||||
time ./$(BUILD_SCRIPT) reconf 2>&1 | tee reconf-$(RELEASE).log
|
||||
|
||||
build : check_args source script
|
||||
time ./$(BUILD_SCRIPT) build 2>&1 | tee build-$(RELEASE).log
|
||||
|
||||
install : check_args source script
|
||||
time ./$(BUILD_SCRIPT) install 2>&1 | tee install-$(RELEASE).log
|
||||
|
||||
pkg : check_args source script
|
||||
time ./$(BUILD_SCRIPT) pkg 2>&1 | tee pkg-$(RELEASE).log
|
||||
|
||||
spkg : check_args source script
|
||||
time ./$(BUILD_SCRIPT) spkg 2>&1 | tee spkg-$(RELEASE).log
|
||||
|
||||
finish : check_args source script
|
||||
time ./$(BUILD_SCRIPT) finish 2>&1 | tee finish-$(RELEASE).log
|
||||
|
||||
upto-conf : check_args source script
|
||||
time ./$(BUILD_SCRIPT) upto-conf 2>&1 | tee upto-conf-$(RELEASE).log
|
||||
|
||||
upto-build : check_args source script
|
||||
time ./$(BUILD_SCRIPT) upto-build 2>&1 | tee upto-build-$(RELEASE).log
|
||||
|
||||
upto-install : check_args source script
|
||||
time ./$(BUILD_SCRIPT) upto-install 2>&1 | tee upto-install-$(RELEASE).log
|
||||
|
||||
upto-pkg : check_args source script
|
||||
time ./$(BUILD_SCRIPT) upto-pkg 2>&1 | tee upto-pkg-$(RELEASE).log
|
||||
|
||||
upto-spkg : check_args source script
|
||||
time ./$(BUILD_SCRIPT) upto-spkg 2>&1 | tee upto-spkg-$(RELEASE).log
|
||||
|
||||
$(BIN_PACKAGE) : $(TARBALL) $(BUILD_SCRIPT)
|
||||
@echo "Building package $(BIN_PACKAGE) / $(SRC_PACKAGE)"
|
||||
time ./$(BUILD_SCRIPT) all 2>&1 | tee all-$(RELEASE).log
|
||||
|
||||
source : check_version check_date $(TARBALL)
|
||||
@echo "created $(TARBALL)"
|
||||
|
||||
$(TARBALL) : dist.sh $(DATE_STAMP).tstamp
|
||||
@echo "Creating $(TARBALL)"
|
||||
time ./dist.sh -v $(VERSION) -r $(RELEASE) -d $(DATE) -pr $(REPOS_PATH) 2>&1 | tee dist-$(RELEASE).log
|
||||
|
||||
script : check_version $(BUILD_SCRIPT)
|
||||
@echo "created $(BUILD_SCRIPT)"
|
||||
|
||||
$(BUILD_SCRIPT) : build.sh
|
||||
ln -f build.sh $(BUILD_SCRIPT)
|
||||
|
||||
$(DATE_STAMP).tstamp :
|
||||
rm -rf *.tstamp
|
||||
touch $(DATE_STAMP).tstamp
|
||||
|
||||
check_args : check_version check_date
|
||||
|
||||
check_version :
|
||||
ifeq ($(strip $(VERSION)),)
|
||||
@echo "No version specified"
|
||||
@make -s usage
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
check_date :
|
||||
ifeq ($(strip $(DATE)),)
|
||||
@echo "No date specified"
|
||||
make usage
|
||||
exit 1
|
||||
endif
|
||||
|
||||
usage:
|
||||
@echo ""
|
||||
@echo "usage: make VERSION=<number> DATE=<xx/xx/xxxx> [RELEASE=<number>] [SIG=<0|1>]"
|
||||
@echo " ie make VERSION=0.1 DATE=10/24/2005"
|
||||
@echo " make VERSION=0.1 DATE=10/24/2005 RELEASE=620 SIG=1"
|
||||
@echo ""
|
||||
330
build/build.sh
Normal file
330
build/build.sh
Normal file
@ -0,0 +1,330 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# IPhreeqcCOM package build script
|
||||
#
|
||||
# $Id: build.sh 4133 2010-02-24 05:50:31Z charlton $
|
||||
#
|
||||
# Package maintainers: if the original source is not distributed as a
|
||||
# (possibly compressed) tarball, set the value of ${src_orig_pkg_name},
|
||||
# and redefine the unpack() helper function appropriately.
|
||||
# Also, if the Makefile rule to run the test suite is not "test", change
|
||||
# the definition of ${test_rule} below.
|
||||
|
||||
# echo everything
|
||||
set -x
|
||||
|
||||
# find out where the build script is located
|
||||
tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
|
||||
test "x$tdir" = "x$0" && tdir=.
|
||||
scriptdir=`cd $tdir; pwd`
|
||||
# find src directory.
|
||||
# If scriptdir ends in SPECS, then topdir is $scriptdir/..
|
||||
# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
|
||||
# Otherwise, we assume that topdir = scriptdir
|
||||
topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
|
||||
topdir2=`echo ${scriptdir} | sed 's%/CYGWIN-PATCHES$%%'`
|
||||
if [ "x$topdir1" != "x$scriptdir" ] ; then # SPECS
|
||||
topdir=`cd ${scriptdir}/..; pwd`
|
||||
else
|
||||
if [ "x$topdir2" != "x$scriptdir" ] ; then # CYGWIN-PATCHES
|
||||
topdir=`cd ${scriptdir}/../..; pwd`
|
||||
else
|
||||
topdir=`cd ${scriptdir}; pwd`
|
||||
fi
|
||||
fi
|
||||
|
||||
tscriptname=`basename $0 .sh`
|
||||
export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
|
||||
export VER=`echo $tscriptname | sed -e "s/${PKG}\-//" -e 's/\-[^\-]*$//'`
|
||||
export REL=`echo $tscriptname | sed -e "s/${PKG}\-${VER}\-//"`
|
||||
export MAJOR=`echo $VER | sed -e 's/\.[^.]*//g'`
|
||||
export MINOR=`echo $VER | sed -e 's/[^\.]*\.//' -e 's/\.[^\.]*//'`
|
||||
export BASEPKG=${PKG}-${VER}-${REL}
|
||||
export FULLPKG=${BASEPKG}
|
||||
export DIFF_IGNORE="-x *.aps -x *.ncb -x *.opt -x *.dep -x *.mak -x *.chm"
|
||||
|
||||
# determine correct decompression option and tarball filename
|
||||
export src_orig_pkg_name=
|
||||
if [ -e "${src_orig_pkg_name}" ] ; then
|
||||
export opt_decomp=? # Make sure tar punts if unpack() is not redefined
|
||||
elif [ -e ${BASEPKG}.tar.gz ] ; then
|
||||
export opt_decomp=z
|
||||
export src_orig_pkg_name=${BASEPKG}.tar.gz
|
||||
else
|
||||
echo Cannot find original package.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export src_orig_pkg=${topdir}/${src_orig_pkg_name}
|
||||
|
||||
# determine correct names for generated files
|
||||
export src_pkg_name=${FULLPKG}-src.tar.bz2
|
||||
export src_patch_name=${FULLPKG}.patch
|
||||
export bin_pkg_name=${FULLPKG}.tar.bz2
|
||||
|
||||
export src_pkg=${topdir}/${src_pkg_name}
|
||||
export src_patch=${topdir}/${src_patch_name}
|
||||
export bin_pkg=${topdir}/${bin_pkg_name}
|
||||
export srcdir=${topdir}/${BASEPKG}
|
||||
export objdir=${srcdir}/.build
|
||||
export instdir=${srcdir}/.inst
|
||||
export srcinstdir=${srcdir}/.sinst
|
||||
export checkfile=${topdir}/${FULLPKG}.check
|
||||
|
||||
prefix=/usr
|
||||
sysconfdir=/etc
|
||||
localstatedir=/var
|
||||
if [ -z "$MY_CFLAGS" ]; then
|
||||
MY_CFLAGS="-O2"
|
||||
fi
|
||||
if [ -z "$MY_LDFLAGS" ]; then
|
||||
MY_LDFLAGS=
|
||||
fi
|
||||
|
||||
export install_docs="\
|
||||
ABOUT-NLS \
|
||||
ANNOUNCE \
|
||||
AUTHORS \
|
||||
BUG-REPORTS \
|
||||
CHANGES \
|
||||
CONTRIBUTORS \
|
||||
COPYING \
|
||||
COPYRIGHT \
|
||||
CREDITS \
|
||||
CHANGELOG \
|
||||
ChangeLog* \
|
||||
FAQ \
|
||||
HOW-TO-CONTRIBUTE \
|
||||
INSTALL \
|
||||
KNOWNBUG \
|
||||
LEGAL \
|
||||
LICENSE \
|
||||
NEWS \
|
||||
NOTES \
|
||||
PROGLIST \
|
||||
README \
|
||||
RELEASE_NOTES \
|
||||
THANKS \
|
||||
TODO \
|
||||
"
|
||||
export install_docs="`for i in ${install_docs}; do echo $i; done | sort -u`"
|
||||
export test_rule=test
|
||||
if [ -z "$SIG" ]; then
|
||||
export SIG=0 # set to 1 to turn on signing by default
|
||||
fi
|
||||
|
||||
# helper function
|
||||
# unpacks the original package source archive into ./${BASEPKG}/
|
||||
# change this if the original package was not tarred
|
||||
# or if it doesn't unpack to a correct directory
|
||||
unpack() {
|
||||
tar xv${opt_decomp}f "$1"
|
||||
}
|
||||
|
||||
mkdirs() {
|
||||
(cd "${topdir}" && \
|
||||
rm -fr "${objdir}" "${instdir}" "${srcinstdir}" && \
|
||||
mkdir -p "${objdir}" && \
|
||||
mkdir -p "${instdir}" && \
|
||||
mkdir -p "${srcinstdir}" )
|
||||
}
|
||||
prep() {
|
||||
(cd "${topdir}" && \
|
||||
unpack "${src_orig_pkg}" && \
|
||||
cd "${topdir}" && \
|
||||
if [ -f "${src_patch}" ] ; then \
|
||||
patch -p0 --binary < "${src_patch}" ;\
|
||||
fi && \
|
||||
mkdirs )
|
||||
}
|
||||
conf() {
|
||||
(cd "${objdir}" && \
|
||||
CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
# copy links to ${objdir} for building
|
||||
find "${srcdir}" -mindepth 1 -maxdepth 1 ! -name .build ! -name .inst ! -name .sinst -exec cp -al {} . \; )
|
||||
}
|
||||
reconf() {
|
||||
(cd ${topdir} && \
|
||||
rm -fr ${objdir} && \
|
||||
mkdir -p ${objdir} && \
|
||||
conf )
|
||||
}
|
||||
build() {
|
||||
(
|
||||
# build IPhreeqcCOM.chm
|
||||
# hhc can't handle directory names that begin with a period
|
||||
cd "${topdir}" && \
|
||||
mv "${srcdir}/.build" "${srcdir}/_build" && \
|
||||
cd "${srcdir}/_build/help" && \
|
||||
make && \
|
||||
cd "${topdir}" && \
|
||||
mv "${srcdir}/_build" "${srcdir}/.build" && \
|
||||
# build IPhreeqcCOM.dll
|
||||
cd "${topdir}" && \
|
||||
cd "${objdir}" && \
|
||||
MsBuild.exe IPhreeqcCOM.sln /t:IPhreeqcCOM /p:Configuration=Release /p:Platform=Win32 && \
|
||||
# build IPhreeqcCOM.dll
|
||||
cd "${topdir}" && \
|
||||
cd "${objdir}" && \
|
||||
MsBuild.exe IPhreeqcCOM.sln /t:IPhreeqcCOM /p:Configuration=Release /p:Platform=x64 && \
|
||||
# build IPhreeqcCOM.msi
|
||||
MsBuild.exe IPhreeqcCOM.sln /t:msi /p:Configuration=Release /p:Platform=Win32 /p:TargetName=${FULLPKG} /p:Major=${MAJOR} /p:Minor=${MINOR} /p:Build=${REL} && \
|
||||
# build IPhreeqcCOMx64.msi
|
||||
MsBuild.exe IPhreeqcCOM.sln /t:msi /p:Configuration=Release /p:Platform=x64 /p:TargetName=${FULLPKG}-x64 /p:Major=${MAJOR} /p:Minor=${MINOR} /p:Build=${REL} )
|
||||
}
|
||||
check() {
|
||||
(cd ${objdir} && \
|
||||
make ${test_rule} | tee ${checkfile} 2>&1 )
|
||||
}
|
||||
clean() {
|
||||
(cd ${objdir} && \
|
||||
make clean )
|
||||
}
|
||||
install() {
|
||||
(rm -fr ${instdir}/* && \
|
||||
# MSI file
|
||||
/usr/bin/install -m 755 "${objdir}/msi/bin/Release/${FULLPKG}.msi" "${instdir}/${FULLPKG}.msi" && \
|
||||
# x64 MSI file
|
||||
/usr/bin/install -m 755 "${objdir}/msi/bin/x64/Release/${FULLPKG}-x64.msi" "${instdir}/${FULLPKG}-x64.msi" && \
|
||||
# Build log
|
||||
if [ -f "${topdir}/all-${REL}.log" ] ; then \
|
||||
/usr/bin/install -m 755 "${topdir}/all-${REL}.log" "${instdir}/all-${REL}.log" ;\
|
||||
fi && \
|
||||
if [ -x /usr/bin/md5sum ]; then \
|
||||
cd "${instdir}" && \
|
||||
find . -type f ! -name md5sum | sed 's/^/\"/' | sed 's/$/\"/' | xargs md5sum > md5sum ; \
|
||||
fi )
|
||||
}
|
||||
strip() {
|
||||
(cd "${instdir}" && \
|
||||
echo 'SKIPPING find . -name "*.dll" -or -name "*.exe" | xargs strip 2>&1' ; \
|
||||
true )
|
||||
}
|
||||
list() {
|
||||
(cd ${instdir} && \
|
||||
find . -name "*" ! -type d | sed 's%^\.% %' ; \
|
||||
true )
|
||||
}
|
||||
depend() {
|
||||
(cd ${instdir} && \
|
||||
find ${instdir} -name "*.exe" -o -name "*.dll" | xargs cygcheck | \
|
||||
sed -e '/\.exe/d' -e 's,\\,/,g' | sort -bu | xargs -n1 cygpath -u \
|
||||
| xargs cygcheck -f | sed 's%^% %' | sort -u ; \
|
||||
true )
|
||||
}
|
||||
pkg() {
|
||||
(cd "${instdir}" && \
|
||||
tar cvjf "${bin_pkg}" * )
|
||||
}
|
||||
mkpatch() {
|
||||
(cd "${srcdir}" && \
|
||||
find . -name "autom4te.cache" | xargs rm -rf ; \
|
||||
unpack "${src_orig_pkg}" && \
|
||||
cd "${srcdir}" && \
|
||||
mv "${BASEPKG}" ../${BASEPKG}-orig && \
|
||||
cd "${topdir}" && \
|
||||
diff -urN -x '.build' -x '.inst' -x '.sinst' \
|
||||
${DIFF_IGNORE} \
|
||||
${BASEPKG}-orig ${BASEPKG} > \
|
||||
${srcinstdir}/${src_patch_name} ; \
|
||||
rm -rf ${BASEPKG}-orig )
|
||||
}
|
||||
# Note: maintainer-only functionality
|
||||
acceptpatch() {
|
||||
cp --backup=numbered ${srcinstdir}/${src_patch_name} ${topdir}
|
||||
}
|
||||
spkg() {
|
||||
(mkpatch && \
|
||||
if [ "${SIG}" -eq 1 ] ; then \
|
||||
name=${srcinstdir}/${src_patch_name} text="PATCH" sigfile ; \
|
||||
fi && \
|
||||
cp "${src_orig_pkg}" "${srcinstdir}/${src_orig_pkg_name}" && \
|
||||
if [ "${SIG}" -eq 1 ] ; then \
|
||||
name=${src_orig_pkg} text="ORIG_PKG" sigfile ; \
|
||||
fi && \
|
||||
cp dist.sh "${srcinstdir}/" && \
|
||||
cp Makefile "${srcinstdir}/" && \
|
||||
if [ -e ${src_orig_pkg}.sig ] ; then \
|
||||
cp ${src_orig_pkg}.sig ${srcinstdir}/ ; \
|
||||
fi && \
|
||||
cp $0 "${srcinstdir}/`basename $0`" && \
|
||||
name=$0 text="SCRIPT" sigfile && \
|
||||
if [ "${SIG}" -eq 1 ] ; then \
|
||||
cp $0.sig "${srcinstdir}/" ; \
|
||||
fi && \
|
||||
cd "${srcinstdir}" && \
|
||||
tar cvjf "${src_pkg}" * )
|
||||
}
|
||||
finish() {
|
||||
rm -rf `echo $phast_ser | sed "s^/.*^^"` && \
|
||||
rm -rf "${srcdir}"
|
||||
}
|
||||
sigfile() {
|
||||
if [ \( "${SIG}" -eq 1 \) -a \( -e $name \) -a \( \( ! -e $name.sig \) -o \( $name -nt $name.sig \) \) ]; then \
|
||||
if [ -x /usr/bin/gpg ]; then \
|
||||
echo "$text signature need to be updated"; \
|
||||
rm -f $name.sig; \
|
||||
/usr/bin/gpg --detach-sign $name; \
|
||||
else \
|
||||
echo "You need the gnupg package installed in order to make signatures."; \
|
||||
fi; \
|
||||
fi
|
||||
}
|
||||
checksig() {
|
||||
if [ -x /usr/bin/gpg ]; then \
|
||||
if [ -e ${src_orig_pkg}.sig ]; then \
|
||||
echo "ORIGINAL PACKAGE signature follows:"; \
|
||||
/usr/bin/gpg --verify ${src_orig_pkg}.sig ${src_orig_pkg}; \
|
||||
else \
|
||||
echo "ORIGINAL PACKAGE signature missing."; \
|
||||
fi; \
|
||||
if [ -e $0.sig ]; then \
|
||||
echo "SCRIPT signature follows:"; \
|
||||
/usr/bin/gpg --verify $0.sig $0; \
|
||||
else \
|
||||
echo "SCRIPT signature missing."; \
|
||||
fi; \
|
||||
if [ -e ${src_patch}.sig ]; then \
|
||||
echo "PATCH signature follows:"; \
|
||||
/usr/bin/gpg --verify ${src_patch}.sig ${src_patch}; \
|
||||
else \
|
||||
echo "PATCH signature missing."; \
|
||||
fi; \
|
||||
else
|
||||
echo "You need the gnupg package installed in order to check signatures." ; \
|
||||
fi
|
||||
}
|
||||
while test -n "$1" ; do
|
||||
case $1 in
|
||||
prep) prep ; STATUS=$? ;;
|
||||
mkdirs) mkdirs ; STATUS=$? ;;
|
||||
conf) conf ; STATUS=$? ;;
|
||||
configure) conf ; STATUS=$? ;;
|
||||
reconf) reconf ; STATUS=$? ;;
|
||||
build) build ; STATUS=$? ;;
|
||||
make) build ; STATUS=$? ;;
|
||||
check) check ; STATUS=$? ;;
|
||||
test) check ; STATUS=$? ;;
|
||||
clean) clean ; STATUS=$? ;;
|
||||
install) install ; STATUS=$? ;;
|
||||
list) list ; STATUS=$? ;;
|
||||
depend) depend ; STATUS=$? ;;
|
||||
strip) strip ; STATUS=$? ;;
|
||||
package) pkg ; STATUS=$? ;;
|
||||
pkg) pkg ; STATUS=$? ;;
|
||||
mkpatch) mkpatch ; STATUS=$? ;;
|
||||
acceptpatch) acceptpatch ; STATUS=$? ;;
|
||||
src-package) spkg ; STATUS=$? ;;
|
||||
spkg) spkg ; STATUS=$? ;;
|
||||
finish) finish ; STATUS=$? ;;
|
||||
checksig) checksig ; STATUS=$? ;;
|
||||
first) mkdirs && spkg && finish ; STATUS=$? ;;
|
||||
all) checksig && prep && conf && build && install && \
|
||||
strip && pkg && spkg && finish ; \
|
||||
STATUS=$? ;;
|
||||
*) echo "Error: bad arguments" ; exit 1 ;;
|
||||
esac
|
||||
( exit ${STATUS} ) || exit ${STATUS}
|
||||
shift
|
||||
done
|
||||
|
||||
228
build/dist.sh
Normal file
228
build/dist.sh
Normal file
@ -0,0 +1,228 @@
|
||||
#!/bin/sh
|
||||
# $Id: dist.sh 4132 2010-02-24 05:35:35Z charlton $
|
||||
|
||||
#
|
||||
# USAGE: ./dist.sh -v VERSION -r REVISION -d RELEASE_DATE
|
||||
# [-rs REVISION-SVN] [-pr REPOS-PATH]
|
||||
# [-zip] [-alpha ALPHA_NUM|-beta BETA_NUM|-rc RC_NUM]
|
||||
#
|
||||
# Create a distribution tarball, labelling it with the given VERSION.
|
||||
# The REVISION or REVISION-SVN will be used in the version string.
|
||||
# The tarball will be constructed from the root located at REPOS-PATH.
|
||||
# If REPOS-PATH is not specified then the default is "branches/VERSION".
|
||||
# For example, the command line:
|
||||
#
|
||||
# ./dist.sh -v 0.24.2 -r 6284
|
||||
#
|
||||
# from the top-level of a branches/0.24.2 working copy will create
|
||||
# the 0.24.2 release tarball.
|
||||
#
|
||||
# When building a alpha, beta or rc tarballs pass the apppropriate flag
|
||||
# followed by the number for that release. For example you'd do
|
||||
# the following for a Beta 1 release:
|
||||
# ./dist.sh -v 1.1.0 -r 10277 -pr branches/1.1.x -beta 1
|
||||
#
|
||||
# If neither an -alpha, -beta or -rc option with a number is
|
||||
# specified, it will build a release tarball.
|
||||
#
|
||||
# To build a Windows zip file package pass -zip.
|
||||
|
||||
# echo everything
|
||||
# set -x
|
||||
|
||||
# A quick and dirty usage message
|
||||
USAGE="USAGE: ./dist.sh -v VERSION -r REVISION -d RELEASE_DATE \
|
||||
[-rs REVISION-SVN ] [-pr REPOS-PATH] \
|
||||
[-alpha ALPHA_NUM|-beta BETA_NUM|-rc RC_NUM] \
|
||||
[-zip]
|
||||
EXAMPLES: ./dist.sh -v 0.36.0 -r 8278 -d 2/7/05
|
||||
./dist.sh -v 0.36.0 -r 8278 -d 2/7/05 -pr trunk
|
||||
./dist.sh -v 0.36.0 -r 8282 -d 2/7/05 -rs 8278 -pr tags/0.36.0
|
||||
./dist.sh -v 0.36.0 -r 8282 -d 2/7/05 -rs 8278 -pr tags/0.36.0 -alpha
|
||||
./dist.sh -v 0.36.0 -r 8282 -d 2/7/05 -rs 8278 -pr tags/0.36.0 -beta 1"
|
||||
|
||||
|
||||
|
||||
|
||||
# Let's check and set all the arguments
|
||||
ARG_PREV=""
|
||||
|
||||
for ARG in $@
|
||||
do
|
||||
if [ "$ARG_PREV" ]; then
|
||||
|
||||
case $ARG_PREV in
|
||||
-v) VERSION="$ARG" ;;
|
||||
-r) REVISION="$ARG" ;;
|
||||
-rs) REVISION_SVN="$ARG" ;;
|
||||
-pr) REPOS_PATH="$ARG" ;;
|
||||
-rc) RC="$ARG" ;;
|
||||
-beta) BETA="$ARG" ;;
|
||||
-alpha) ALPHA="$ARG" ;;
|
||||
-d) RDATE="$ARG" ;;
|
||||
*) ARG_PREV=$ARG ;;
|
||||
esac
|
||||
|
||||
ARG_PREV=""
|
||||
|
||||
else
|
||||
|
||||
case $ARG in
|
||||
-v|-r|-rs|-pr|-beta|-rc|-alpha|-d)
|
||||
ARG_PREV=$ARG
|
||||
;;
|
||||
-zip)
|
||||
ZIP=1
|
||||
ARG_PREV=""
|
||||
;;
|
||||
*)
|
||||
echo " $USAGE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$REVISION_SVN" ]; then
|
||||
REVISION_SVN=$REVISION
|
||||
fi
|
||||
|
||||
if [ -n "$ALPHA" ] && [ -n "$BETA" ] ||
|
||||
[ -n "$ALPHA" ] && [ -n "$RC" ] ||
|
||||
[ -n "$BETA" ] && [ -n "$RC" ] ; then
|
||||
echo " $USAGE"
|
||||
exit 1
|
||||
elif [ -n "$ALPHA" ] ; then
|
||||
VER_TAG="Alpha $ALPHA"
|
||||
VER_NUMTAG="-alpha$ALPHA"
|
||||
elif [ -n "$BETA" ] ; then
|
||||
VER_TAG="Beta $BETA"
|
||||
VER_NUMTAG="-beta$BETA"
|
||||
elif [ -n "$RC" ] ; then
|
||||
VER_TAG="Release Candidate $RC"
|
||||
VER_NUMTAG="-rc$RC"
|
||||
else
|
||||
VER_TAG="r$REVISION_SVN"
|
||||
VER_NUMTAG="-$REVISION"
|
||||
fi
|
||||
|
||||
if [ -n "$ZIP" ] ; then
|
||||
EXTRA_EXPORT_OPTIONS="--native-eol CRLF"
|
||||
fi
|
||||
|
||||
if [ -z "$VERSION" ] || [ -z "$REVISION" ] || [ -z "$RDATE" ]; then
|
||||
echo " $USAGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VER="$VERSION"
|
||||
REL="$REVISION"
|
||||
LOWER='abcdefghijklmnopqrstuvwxyz'
|
||||
UPPER='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
VER_UC=`echo $VER | sed -e "y/$LOWER/$UPPER/"`
|
||||
|
||||
RELEASE_DATE="`date -d "$RDATE" "+%B %e, %G"`"
|
||||
V_FIXDATE="`date -d "$RDATE" "+%d-%b-%G"`"
|
||||
|
||||
if [ -z "$REPOS_PATH" ]; then
|
||||
REPOS_PATH="branches/$VERSION"
|
||||
else
|
||||
REPOS_PATH="`echo $REPOS_PATH | sed 's/^\/*//'`"
|
||||
fi
|
||||
|
||||
DISTNAME="IPhreeqc-${VERSION}${VER_NUMTAG}"
|
||||
DIST_SANDBOX=.dist_sandbox
|
||||
DISTPATH="$DIST_SANDBOX/$DISTNAME"
|
||||
|
||||
echo "Distribution will be named: $DISTNAME"
|
||||
echo " release branch's revision: $REVISION"
|
||||
echo " executable's revision: $REVISION_SVN"
|
||||
echo " constructed from path: /$REPOS_PATH"
|
||||
echo " release date: $RELEASE_DATE"
|
||||
|
||||
rm -rf "$DIST_SANDBOX"
|
||||
mkdir "$DIST_SANDBOX"
|
||||
echo "Removed and recreated $DIST_SANDBOX"
|
||||
|
||||
echo "Exporting revision $REVISION of IPhreeqcCOM into sandbox..."
|
||||
(cd "$DIST_SANDBOX" && \
|
||||
${SVN:-svn} export -q $EXTRA_EXPORT_OPTIONS --ignore-externals -r "$REVISION" \
|
||||
"http://internalbrr.cr.usgs.gov/svn_GW/IPhreeqc/$REPOS_PATH" \
|
||||
"$DISTNAME")
|
||||
|
||||
(cd "$DIST_SANDBOX" && \
|
||||
${SVN:-svn} export -q $EXTRA_EXPORT_OPTIONS --ignore-externals -r "$REVISION" \
|
||||
"http://internalbrr.cr.usgs.gov/svn_GW/phreeqcpp/$REPOS_PATH/src" \
|
||||
"$DISTNAME/phreeqcpp")
|
||||
|
||||
(cd "$DIST_SANDBOX" && \
|
||||
${SVN:-svn} export -q $EXTRA_EXPORT_OPTIONS --ignore-externals -r "$REVISION" \
|
||||
"http://internalbrr.cr.usgs.gov/svn_GW/phreeqc/$REPOS_PATH/src" \
|
||||
"$DISTNAME/phreeqcpp/phreeqc")
|
||||
|
||||
ver_major=`echo $VERSION | cut -d '.' -f 1`
|
||||
ver_minor=`echo $VERSION | cut -d '.' -f 2`
|
||||
ver_patch=`echo $VERSION | cut -d '.' -f 3`
|
||||
|
||||
if [ -z "$ver_patch" ]; then
|
||||
ver_patch="0"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
SED_FILES="$DISTPATH/build/version.h"
|
||||
|
||||
for vsn_file in $SED_FILES
|
||||
do
|
||||
sed \
|
||||
-e "/#define *VER_MAJOR/s/[0-9]\+/$ver_major/" \
|
||||
-e "/#define *VER_MINOR/s/[0-9]\+/$ver_minor/" \
|
||||
-e "/#define *VER_PATCH/s/[0-9]\+/$ver_patch/" \
|
||||
-e "/#define *VER_REVISION/s/[0-9]\+/$REVISION_SVN/" \
|
||||
-e "s/@RELEASE_DATE@/$RELEASE_DATE/g" \
|
||||
< "$vsn_file" > "$vsn_file.tmp"
|
||||
unix2dos "$vsn_file.tmp" 2> /dev/null
|
||||
mv -f "$vsn_file.tmp" "$vsn_file"
|
||||
cp "$vsn_file" "$vsn_file.dist"
|
||||
done
|
||||
|
||||
|
||||
if [ -z "$ZIP" ]; then
|
||||
echo "Rolling $DISTNAME.tar ..."
|
||||
(cd "$DIST_SANDBOX" > /dev/null && tar c "$DISTNAME") > \
|
||||
"$DISTNAME.tar"
|
||||
echo "Compressing to $DISTNAME.tar.gz ..."
|
||||
gzip -9f "$DISTNAME.tar"
|
||||
else
|
||||
echo "Rolling $DISTNAME.zip ..."
|
||||
(cd "$DIST_SANDBOX" > /dev/null && zip -q -r - "$DISTNAME") > \
|
||||
"$DISTNAME.zip"
|
||||
fi
|
||||
echo "Removing sandbox..."
|
||||
rm -rf "$DIST_SANDBOX"
|
||||
|
||||
echo ""
|
||||
echo "Done:"
|
||||
if [ -z "$ZIP" ]; then
|
||||
ls -l "$DISTNAME.tar.gz"
|
||||
echo ""
|
||||
echo "md5sums:"
|
||||
md5sum "$DISTNAME.tar.gz"
|
||||
type sha1sum > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo ""
|
||||
echo "sha1sums:"
|
||||
sha1sum "$DISTNAME.tar.gz"
|
||||
fi
|
||||
else
|
||||
ls -l "$DISTNAME.zip"
|
||||
echo ""
|
||||
echo "md5sum:"
|
||||
md5sum "$DISTNAME.zip"
|
||||
type sha1sum > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo ""
|
||||
echo "sha1sum:"
|
||||
sha1sum "$DISTNAME.zip"
|
||||
fi
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user