pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedPgJDBC Build Script
2+ messages / 2 participants
[nested] [flat]
* PgJDBC Build Script
@ 2012-11-15 01:26 dmp <danap@ttc-cmc.net>
0 siblings, 1 reply; 2+ messages in thread
From: dmp @ 2012-11-15 01:26 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; Kris Jurka <books@ejurka.com>; pgsql-jdbc
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: PgJDBC Build Script
@ 2012-11-15 01:48 Dave Cramer <pg@fastcrypt.com>
parent: dmp <danap@ttc-cmc.net>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Cramer @ 2012-11-15 01:48 UTC (permalink / raw)
To: dmp <danap@ttc-cmc.net>; +Cc: Kris Jurka <books@ejurka.com>; pgsql-jdbc
Dana,
Thanks for this! This is a work in progress, no apologies necessary.
Dave
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On Wed, Nov 14, 2012 at 8:26 PM, dmp <danap@ttc-cmc.net> wrote:
> 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.
>
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2012-11-15 01:48 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 01:26 PgJDBC Build Script dmp <danap@ttc-cmc.net>
2012-11-15 01:48 ` Dave Cramer <pg@fastcrypt.com>
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