pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dmp <danap@ttc-cmc.net>
To: Dave Cramer <pg@fastcrypt.com>
To: Kris Jurka <books@ejurka.com>
To: pgsql-jdbc@postgresql.org
Subject: PgJDBC Build Script
Date: Wed, 14 Nov 2012 18:26:44 -0700
Message-ID: <50A444D4.9070405@ttc-cmc.net> (raw)
In-Reply-To: <CADK3HHKf6WeEyMUUR8o31Xb6Mrt_xW92Fd5+cnZtFfBaioAnQw@mail.gmail.com>
References: <k80udc$b81$1@ger.gmane.org>
	<CADK3HHKh6v4u0n4oDtPXPxb2G+nu4m+7pjcfJKJr1wngDsc2Hg@mail.gmail.com>
	<CADK3HHLR=BLk21YjZUOZ7Qfa8PSxjWR2xum-VXjxa-koS_x8kg@mail.gmail.com>
	<0fa46b92-e6cd-446c-8101-2f995e621377@googlegroups.com>
	<CADK3HHKf6WeEyMUUR8o31Xb6Mrt_xW92Fd5+cnZtFfBaioAnQw@mail.gmail.com>

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.

Attachments:

pgjdbc-build.sh (text/plain, 5.1K) download #!/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

view thread (2+ messages)  latest in thread

Message-ID: <50A444D4.9070405@ttc-cmc.net>
Permalink:  ../50A444D4.9070405@ttc-cmc.net/
Also on:    postgresql.org/message-id/50A444D4.9070405@ttc-cmc.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: danap@ttc-cmc.net, pg@fastcrypt.com, books@ejurka.com
  Subject: Re: PgJDBC Build Script
  In-Reply-To: <50A444D4.9070405@ttc-cmc.net>
  References: <k80udc$b81$1@ger.gmane.org> <CADK3HHKh6v4u0n4oDtPXPxb2G+nu4m+7pjcfJKJr1wngDsc2Hg@mail.gmail.com> <CADK3HHLR=BLk21YjZUOZ7Qfa8PSxjWR2xum-VXjxa-koS_x8kg@mail.gmail.com> <0fa46b92-e6cd-446c-8101-2f995e621377@googlegroups.com> <CADK3HHKf6WeEyMUUR8o31Xb6Mrt_xW92Fd5+cnZtFfBaioAnQw@mail.gmail.com> <50A444D4.9070405@ttc-cmc.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox