Commit 671be619 authored by Peter Eisentraut's avatar Peter Eisentraut

Add uninstall target to Java build.

Respect default port setting in JDBC driver.
Pick up version number from Makefile.global.
Change installation directory to share/java/.
Document.
parent 9c2c9fcd
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
detect the presence of both the JDK and ANT, and if both are found detect the presence of both the JDK and ANT, and if both are found
to build the jdbc driver and utils with the rest of postgresql. to build the jdbc driver and utils with the rest of postgresql.
$Id: build.xml,v 1.2 2001/03/05 09:38:54 peter Exp $ $Id: build.xml,v 1.3 2001/03/11 11:06:59 petere Exp $
--> -->
...@@ -69,6 +69,12 @@ e.g. ...@@ -69,6 +69,12 @@ e.g.
</antcall> </antcall>
</target> </target>
<target name="uninstall" if="install.directory">
<antcall target="call">
<param name="target" value="uninstall" />
</antcall>
</target>
<!-- <!--
This actually calls the other two build.xml files. This actually calls the other two build.xml files.
To use it, use the <antcall> tag, and pass the destination target To use it, use the <antcall> tag, and pass the destination target
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
build file to build the donated retep tools packages build file to build the donated retep tools packages
$Id: build.xml,v 1.3 2001/03/05 09:15:35 peter Exp $ $Id: build.xml,v 1.4 2001/03/11 11:06:59 petere Exp $
--> -->
...@@ -56,5 +56,12 @@ ...@@ -56,5 +56,12 @@
</copy> </copy>
</target> </target>
</project> <target name="uninstall" if="install.directory">
<delete>
<fileset dir="${install.directory}">
<include name="**/*.jar" />
</fileset>
</delete>
</target>
</project>
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.19 2001/02/24 12:40:27 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.20 2001/03/11 11:06:59 petere Exp $
--> -->
<chapter id="jdbc"> <chapter id="jdbc">
...@@ -53,55 +53,49 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.19 2001/02/24 12:40:27 ...@@ -53,55 +53,49 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.19 2001/02/24 12:40:27
<para> <para>
Starting with <productname>PostgreSQL</productname> version 7.1, Starting with <productname>PostgreSQL</productname> version 7.1,
the preferred way to build the <acronym>JDBC</acronym> driver is the <acronym>JDBC</acronym> driver is built using
using <productname>Ant</productname>, a special tool for building <application>Ant</application>, a special tool for building
Java-based packages. You should download Java-based packages. You should download
<productname>Ant</productname> from the <ulink <application>Ant</application> from the <ulink
url="http://jakarta.apache.org/ant/index.html"><productname>Ant</productname> url="http://jakarta.apache.org/ant/index.html"><application>Ant</application>
web site</ulink> and install it before proceeding. web site</ulink> and install it before proceeding. Precompiled
</para> <application>Ant</application> distributions are typically set up
to read a file <filename>.antrc</filename> in the current user's
<para> home directory for configuration. For example, to use a different
The build the driver, issue the command <acronym>JDK</acronym> than the default, this may work:
<screen> <programlisting>
<prompt>$</prompt> <userinput>ant</userinput> JAVA_HOME=/usr/local/sun-jdk1.3
</screen> JAVACMD=$JAVA_HOME/bin/java
in the top level directory of the </programlisting>
<productname>PostgreSQL</productname> source distribution.
</para>
<para>
To install the driver, enter the command
<screen>
<prompt>$</prompt> <userinput>ant -Dinstall.directory=<replaceable>mydir</replaceable> install</userinput>
</screen>
Replace <replaceable>mydir</replaceable> with a directory name of
your choice; the directory will be created if necessary. The
<productname>PostgreSQL</productname> <acronym>JDBC</acronym>
driver consists of a <filename>postgresql.jar</filename> file that
will be copied to that directory.
</para> </para>
<para> <para>
Alternatively, you can use the old <command>make</command>-based The build the driver, add the <option>--with-java</option> option to your
interface. The driver's source is located in the <filename <filename>configure</filename> command line, e.g.,
class="directory">src/interfaces/jdbc</filename> directory of the
source tree. To compile, simply change directory to that
directory, and type:
<screen> <screen>
<prompt>$</prompt> <userinput>gmake</userinput> <prompt>$</prompt> <userinput>./configure --prefix=<replaceable>xxx</replaceable> --with-java ...</userinput>
</screen> </screen>
(Remember to use <acronym>GNU</acronym> make.) Upon completion, This will build and install the driver along with the rest of the
you will find the archive <filename>postgresql.jar</filename> in <productname>PostgreSQL</productname> package when you issue the
the current directory. This is the <acronym>JDBC</acronym> driver, <literal>gmake</literal> and <literal>gmake install</literal>
which you can copy to an appropriate directory in your system. commands. If you only want to build the driver and not the rest
of <productname>PostgreSQL</productname>, change into the
directory <filename
class="directory">src/interfaces/jdbc</filename> and issue the
respective <literal>make</literal> command there. Refer to the
<productname>PostgreSQL</productname> installation instructions
for more information about the configuration and build process.
</para> </para>
<note> <note>
<para> <para>
You must not use <command>javac</command> directly, as the Do not try to build by calling <command>javac</command> directly,
driver uses some dynamic loading techniques for performance as the driver uses some dynamic loading techniques for
reasons, and <command>javac</command> cannot cope. performance reasons, and <command>javac</command> cannot cope.
Do not try to run <command>ant</command> directly either, because
some configuration information is communicated through the
makefiles. Running <command>ant</command> directly without
providing these parameters will result in a broken driver.
</para> </para>
</note> </note>
</sect2> </sect2>
...@@ -114,7 +108,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.19 2001/02/24 12:40:27 ...@@ -114,7 +108,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.19 2001/02/24 12:40:27
<filename>postgresql.jar</filename> needs to be included in the <filename>postgresql.jar</filename> needs to be included in the
class path, either by putting it in the <envar>CLASSPATH</envar> class path, either by putting it in the <envar>CLASSPATH</envar>
environment variable, or by using flags on the environment variable, or by using flags on the
<command>java</command> command line. <command>java</command> command line. By default, the jar archive
is installed in the directory <filename
class="directory">/usr/local/pgsql/share/java</filename>. You may
have it in a different directory if you used the
<option>--prefix</option> option when you ran
<filename>configure</filename>.
</para> </para>
<informalexample> <informalexample>
...@@ -128,7 +127,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.19 2001/02/24 12:40:27 ...@@ -128,7 +127,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.19 2001/02/24 12:40:27
<filename>/usr/local/jdk1.1.6</filename>. To run the <filename>/usr/local/jdk1.1.6</filename>. To run the
application, I would use: application, I would use:
<programlisting> <programlisting>
export CLASSPATH=/usr/local/lib/finder.jar<co id="co.jdbc-finder">:/usr/local/lib/postgresql.jar:. export CLASSPATH=/usr/local/lib/finder.jar<co id="co.jdbc-finder">:/usr/local/pgsql/share/java/postgresql.jar:.
java uk.org.retep.finder.Main java uk.org.retep.finder.Main
</programlisting> </programlisting>
<calloutlist> <calloutlist>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/Makefile,v 1.27 2001/03/05 09:39:53 peter Exp $ # $Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/Makefile,v 1.28 2001/03/11 11:07:00 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -12,17 +12,28 @@ subdir = src/interfaces/jdbc ...@@ -12,17 +12,28 @@ subdir = src/interfaces/jdbc
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
all distprep: majorversion := $(shell echo $(VERSION) | sed 's/^\([0-9][0-9]*\)\..*$$/\1/')
@$(ANT) -buildfile $(top_builddir)/build.xml minorversion := $(shell echo $(VERSION) | sed 's/^[0-9][0-9]*\.\([0-9][0-9]*\).*$$/\1/')
install: properties := -Dmajor=$(majorversion) -Dminor=$(minorversion) \
@$(ANT) -Dinstall.directory=$(DESTDIR)$(libdir)/java \ -Dfullversion=$(VERSION) \
-buildfile $(top_builddir)/build.xml \ -Ddef_pgport=$(DEF_PGPORT)
install
installdirs uninstall dep depend: all:
@echo Nothing for JDBC $(ANT) -buildfile $(top_srcdir)/build.xml $(properties)
clean distclean maintainer-clean: install: installdirs
@$(ANT) -buildfile $(top_builddir)/build.xml clean $(ANT) -Dinstall.directory=$(DESTDIR)$(datadir)/java \
-buildfile $(top_srcdir)/build.xml \
install $(properties)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(datadir)/java
uninstall:
$(ANT) -Dinstall.directory=$(DESTDIR)$(datadir)/java \
-buildfile $(top_srcdir)/build.xml \
uninstall
clean distclean maintainer-clean:
$(ANT) -buildfile $(top_srcdir)/build.xml clean
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
build file to allow ant (http://jakarta.apache.org/ant/) to be used build file to allow ant (http://jakarta.apache.org/ant/) to be used
to build the PostgreSQL JDBC Driver. to build the PostgreSQL JDBC Driver.
$Id: build.xml,v 1.7 2001/03/05 09:40:01 peter Exp $ $Id: build.xml,v 1.8 2001/03/11 11:07:00 petere Exp $
--> -->
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
<property name="jars" value="jars" /> <property name="jars" value="jars" />
<property name="dest" value="build" /> <property name="dest" value="build" />
<property name="package" value="org/postgresql" /> <property name="package" value="org/postgresql" />
<property name="major" value="7" />
<property name="minor" value="1" />
<!-- <!--
defaults for the tests - overide these if required defaults for the tests - overide these if required
...@@ -68,8 +66,9 @@ ...@@ -68,8 +66,9 @@
<!-- Some defaults --> <!-- Some defaults -->
<filter token="MAJORVERSION" value="${major}" /> <filter token="MAJORVERSION" value="${major}" />
<filter token="MINORVERSION" value="${minor}" /> <filter token="MINORVERSION" value="${minor}" />
<filter token="VERSION" value="PostgreSQL ${major}.${minor} ${edition}" /> <filter token="VERSION" value="PostgreSQL ${fullversion} ${edition}" />
<filter token="JDBCCONNECTCLASS" value="${connectclass}" /> <filter token="JDBCCONNECTCLASS" value="${connectclass}" />
<filter token="DEF_PGPORT" value="${def_pgport}" />
<!-- Put a check for the current version here --> <!-- Put a check for the current version here -->
...@@ -153,6 +152,17 @@ ...@@ -153,6 +152,17 @@
</copy> </copy>
</target> </target>
<!--
Uninstall the jar file.
-->
<target name="uninstall" if="install.directory">
<delete>
<fileset dir="${install.directory}">
<include name="**/*.jar" />
</fileset>
</delete>
</target>
<!-- <!--
This compiles and executes the JUnit tests This compiles and executes the JUnit tests
--> -->
......
...@@ -351,7 +351,7 @@ public class Driver implements java.sql.Driver ...@@ -351,7 +351,7 @@ public class Driver implements java.sql.Driver
*/ */
public int port() public int port()
{ {
return Integer.parseInt(props.getProperty("PGPORT","5432")); return Integer.parseInt(props.getProperty("PGPORT","@DEF_PGPORT@"));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment