Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYoQW-00057r-MD for pgsql-jdbc@postgresql.org; Thu, 15 Nov 2012 01:39:32 +0000 Received: from outbound.vnet-inc.com ([216.146.104.103]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYoQS-0000Eg-8P for pgsql-jdbc@postgresql.org; Thu, 15 Nov 2012 01:39:31 +0000 Received: from [192.168.157.132] (unknown [76.75.27.41]) by outbound.vnet-inc.com (Postfix) with ESMTP id 242865A59; Wed, 14 Nov 2012 18:39:29 -0700 (MST) Message-ID: <50A444D4.9070405@ttc-cmc.net> Date: Wed, 14 Nov 2012 18:26:44 -0700 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.13) Gecko/20100914 SeaMonkey/2.0.8 MIME-Version: 1.0 To: Dave Cramer , Kris Jurka , pgsql-jdbc@postgresql.org Subject: PgJDBC Build Script References: <0fa46b92-e6cd-446c-8101-2f995e621377@googlegroups.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------010902040006080902070800" X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201211/74 X-Sequence-Number: 23541 This is a multi-part message in MIME format. --------------010902040006080902070800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Dave, I reviewed the building of the jars files for the various SDKs and the original script I created did not properly build with the proper names. I'm still not sure if this is correct, since the ant build.xml and web page do not appear to correspond. Corrected: 1.2 & 1.3, jdbc2 1.4 jdbc3 1.5 jdbc3g 1.6 jdbc4 1.7 & 1.8 jdbc41 The file is attached if you still wish to use it. I'm sorry for not properly reviewing the requirements of the various required names for the builds. I left the source creation the same for now. Again if SDK 1.7 & 1.8 are both present then the result jdbc41 jar will be the build from 1.8. Perhaps this should be checked and left with the lower build jar file if present. danap. --------------010902040006080902070800 Content-Type: text/plain; name="pgjdbc-build.sh" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pgjdbc-build.sh" #!/bin/sh # # Copyright (c) 2012 PostgreSQL Global Development Group # # Bourne shell script to build the various Java version jar # files for the PosgtreSQL JDBC. # # Author Dana M. Proctor, danap@dandymadeproductions.com # Version 1.0 10/31/2012 # 1.1 11/05/2012 Add -s Switch Argument to Build tar.gz Source File. # 1.2 11/14/2012 Correction for jdbc3 for 1.4, jdbc3g 1.5, jdbc4 # 1.6, jdbc41 1.7/1.8. Added PGJDBC_BUILD_VERSION & # Output During Building. # # Requirements: # # 1. To be used from the root pgjdbc source code directory. # 2. At lease one of the Java SDKs, the JRE is not sufficient. # 3. Apache-Ant. # # Arugments: -s, Build Source File. # # # Setup some default system variables. # ORGINAL_PATH=$PATH LOCAL_BIN=$HOME/pgjdbc_bin BUILD_PATH=$LOCAL_BIN:$PATH PGJDBC_BUILD_VERSION=1.2 # # Set your local installation system variables. # JAVA_SDK_PATH=/usr/lib/java ANT_INSTALL_HOME=/usr/local/lib/apache-ant-1.8.4 ANT_JAR=jars/postgresql.jar BUILD_JARS=build-jars SOURCE_BASE_NAME=postgresql-jdbc SOURCE_DIRS=doc\\nMETA-INF\\norg SOURCE_FILES=build.properties\\nbuild.xml\\nLICENSE\\nREADME\\nupdate-translations.sh # Can not check everything, but at least # see if Java SDK path and ant path good. if [ ! -d $JAVA_SDK_PATH ]; then echo "The Java SDK path does not appear to be valid!" exit 1 fi echo "JAVA_SDK_PATH="$JAVA_SDK_PATH if [ -z $ANT_HOME ]; then ANT_HOME=$ANT_INSTALL_HOME export ANT_HOME fi echo "ANT_HOME="$ANT_HOME if [ ! -d $ANT_HOME ]; then echo "The Apache-Ant variable ANT_HOME does not appear to be valid!" exit 1 fi # Collect an input from the user to indicate the version # build for the jars. echo echo -n "Please input a version of the build, ex(9.2-1001): " read VERSION echo # Main part of script that loops through the directories in # the JAVA_SDK_PATH to build the required jar file(s) for each # version of the SDK encountered. mkdir $LOCAL_BIN if [ ! -d $BUILD_JARS ]; then mkdir $BUILD_JARS fi PATH=$BUILD_PATH export PATH for contents in `ls $JAVA_SDK_PATH` ; do # Create complete path for contents # derived and see if appears to be a # valid JDK. JAVA_SDK=$JAVA_SDK_PATH/$contents if [ -d $JAVA_SDK ] && [ -f $JAVA_SDK/bin/javac ]; then #echo $JAVA_SDK # Valid JDK so set the JAVA_HOME, create links in # LOCAL_BIN to the JAVA_SDK. JAVA_HOME=$JAVA_SDK export JAVA_HOME ln -s $JAVA_SDK/bin/java $LOCAL_BIN/java ln -s $JAVA_SDK/bin/javac $LOCAL_BIN/javac # Collect the appropriate Java Version for # composing the jar name extension. Since # the output from many java programs use # System.err instead of System.out then need # capture that instead to get SDK_VERSION. # 2> means redirect stderr. &1 means to the # same place as stdout. SDK_VERSION="$(java -version 2>&1)" echo echo "pgjdbc-build v$PGJDBC_BUILD_VERSION Building....." echo "SDK_VERSION="$SDK_VERSION case "$SDK_VERSION" in *\ 1.1*) JAVA_VERSION="jdbc1" ;; *\ 1.2* | *\ 1.3*) JAVA_VERSION="jdbc2" ;; *\ 1.4*) JAVA_VERSION="jdbc3" ;; *\ 1.5*) JAVA_VERSION="jdbc3g" ;; *\ 1.6*) JAVA_VERSION="jdbc4" ;; *\ 1.7* | *\ 1.8*) JAVA_VERSION="jdbc41" ;; *) JAVA_VERSION="jdbc?" ;; esac #echo $JAVA_VERSION # Build the jar file now that everthing has # been setup and collected as needed. $ANT_HOME/bin/ant clean $ANT_HOME/bin/ant # Check to see if build was successful. If so # then move the created jar to the appropriate # name so the next build can take place and # cleanup links. if [ -f $ANT_JAR ]; then mv $ANT_JAR $BUILD_JARS/"postgresql-"$VERSION"."$JAVA_VERSION".jar" fi if [ -f $LOCAL_BIN/java ]; then rm $LOCAL_BIN/java fi if [ -f $LOCAL_BIN/javac ]; then rm $LOCAL_BIN/javac fi fi done # # Build source provided the -s switch argument was given. # if [ $# = 1 ] && [ "$1" = "-s" ]; then # Create the source directory based on the base # name and the input given for the version. SOURCE_DIRECTORY=$SOURCE_BASE_NAME-$VERSION.src #echo "SOURCE_DIRECTORY:$SOURCE_DIRECTORY" if [ ! -d $SOURCE_DIRECTORY ]; then mkdir $SOURCE_DIRECTORY fi # Move the required contents to be source directory # for compression. for directory in `printf "$SOURCE_DIRS"` ; do if [ -d $directory ]; then cp -R $directory $SOURCE_DIRECTORY fi done for file in `printf "$SOURCE_FILES"` ; do if [ -f $file ]; then cp $file $SOURCE_DIRECTORY fi done # Create the compressed source file. tar -czvf $BUILD_JARS/$SOURCE_DIRECTORY.tar.gz $SOURCE_DIRECTORY > /dev/null 2>&1 fi # Cleanup, the path shouldn't of changed, # on exit. if [ -d $LOCAL_BIN ]; then rm -rf $LOCAL_BIN fi if [ -d $SOURCE_DIRECTORY ]; then rm -rf $SOURCE_DIRECTORY fi PATH=$ORIGINAL_PATH export PATH exit 0 --------------010902040006080902070800--