#!/bin/sh # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ######################################################################################### # # This script compiles a JSPWiki release. ATM it's pretty much hardcoded to certain basic # assumptions (OSX, Europe, distributions go to ecyrd.com). We can fix these later. # # Usage: build_jspwiki_distro.sh [branchname] # # E.g. branchname can be "tags/jspwiki_3_0_0" or "branches/JSPWIKI_2_8_BRANCH" or "trunk". Default is "trunk". # # You may set the following environmental variables before you invoke this script # # DESTDIR : where the final deliverables are built # JAVA_HOME : where the java home is. # if [ "${DESTDIR}" = "" ] then DESTDIR=${HOME}/Documents/public_html fi if [ "${JAVA_HOME}" = "" ] then JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home fi BUILDDIR=/tmp/${USER}/JSPWiki-build/ BUILDPROPERTIES=${HOME}/Projects/jspwiki_release_build.properties LOGFILE=${BUILDDIR}/build.log BASEURL="http://www.ecyrd.com/~jalkanen/JSPWiki" SVNHOME="http://svn.eu.apache.org/repos/asf/incubator/" SVNPROJECT="jspwiki" BRANCH="trunk" # # Creates the checksums and GPG signature of a release artifact # function checknsign { gpg --print-md MD5 $1 > $1.md5 gpg --print-md SHA1 $1 > $1.sha gpg -sba $1 } # # Start # if [ $# -gt 0 ] then BRANCH=$1 fi if [ "${BRANCH}" == "" ] then echo "Illegal branch name" exit 1 fi echo "DESTDIR=${DESTDIR}" echo "JAVA_HOME=${JAVA_HOME}" echo "Using branch '${BRANCH}' from ${SVNHOME}/${SVNPROJECT}" # # Cleanup # rm -f ${LOGFILE} date > ${LOGFILE} echo "Cleaning up previous build..." rm -rf ${BUILDDIR} mkdir -p ${BUILDDIR} cd ${BUILDDIR} || ( echo "Failed CD" && exit 5 ) echo "Checking out project from SVN..." svn co ${SVNHOME}/${SVNPROJECT}/${BRANCH} ${SVNPROJECT} >> ${LOGFILE} echo "Compiling..." cd ${SVNPROJECT} ant dist -Dbuild.properties=${BUILDPROPERTIES} >> ${LOGFILE} # # Compilation done, now prepare the proper place for the distribution # VERSION=`java -cp build/JSPWiki.jar org.apache.wiki.Release` echo "${SVNPROJECT} version ${VERSION}: preparing distro..." DIST=${BUILDDIR}/${SVNPROJECT}/releases DISTBIN=${DIST}/JSPWiki-bin.zip DISTSRC=${DIST}/JSPWiki-src.zip BINSIZE=`ls -sk ${DISTBIN} | awk '{print $1}'` SRCSIZE=`ls -sk ${DISTSRC} | awk '{print $1}'` TODAY=`date +%d-%b-%Y` WEBURL=${BASEURL}/${VERSION} DESTBIN=JSPWiki-${VERSION}-bin.zip DESTSRC=JSPWiki-${VERSION}-src.zip # # Copy it to the proper place # DEST=${DESTDIR}/JSPWiki/${VERSION} echo "Deliverables go to ${DEST}..." mkdir -p ${DEST} cd ${DEST} || ( echo "Could not find directory" && exit 5 ) cp ${DISTBIN} ${DEST}/${DESTBIN} cp ${DISTSRC} ${DEST}/${DESTSRC} cp ${BUILDDIR}/JSPWiki/README ${DEST} cp ${BUILDDIR}/JSPWiki/ChangeLog ${DEST} cp ${BUILDDIR}/JSPWiki/ReleaseNotes ${DEST} # Generate checksums and signatures. checknsign ${DEST}/${DESTBIN} checknsign ${DEST}/${DESTSRC} # # Finished. # echo "Done." echo echo "Put the following in your Wiki:" echo "${TODAY}: [JSPWiki ${VERSION}|${WEBURL}/${DESTBIN}] package (${BINSIZE} kB) ([GPG signature|${WEBURL}/${DESTBIN}.asc]). [Source code|${WEBURL}/${DESTSRC}] (${SRCSIZE} kB) ([GPG signature|${WEBURL}/${DESTSRC}.asc]). See also [ReleaseNotes|${WEBURL}/ReleaseNotes], [ChangeLog|${WEBURL}/ChangeLog], and [README|${WEBURL}/README]." echo echo "Now run 'unison grey'"