Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Oct 2000 11:24:54 -0400 (EDT)
From:      Mikhail Teterin <mi@monsta.privatelabs.com>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        scrappy@freebsd.org, andreas@freebsd.org
Subject:   ports/21784: further improving the PostgreSQL port
Message-ID:  <200010061524.e96FOs775856@monsta.privatelabs.com>

next in thread | raw e-mail | index | archive | help

>Number:         21784
>Category:       ports
>Synopsis:       further improving the PostgreSQL port
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 06 08:30:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Mikhail Teterin
>Release:        FreeBSD 4.1.1-STABLE i386
>Organization:
Virtual Estates, Inc.
>Environment:

>Description:

	My additions improve the following:
	* Postgres builds with SSL support (unless unavailable)
	* It is possible to build it with TCL but WITHOUT_TK support.
	  This is needed  for X11-less servers, where you still wish
	  to use non-GUI TCL script (I use it with the mod_dtcl module
	  for Apache).
	* The port creates pkgIndex.tcl file to help loading Pgtcl
	  module into TCL applications
	
	I also modified the post-install-notes to say, that the pgaccess
	now comes with PG itself and there is no need to install it
	separately.

	There appears to be a bug, introduced with the most recent update:
	Package creation fails if one specifies WITH_ODBC but not WITH_JAVA.

	I did not address this -- I'm not sure how the two are related.

	With the growing number of build options, it is probably time for a
	dialog(1) based manu (like it php and ghostscript ports).

>How-To-Repeat:

	

>Fix:

--- Makefile	Mon Sep 25 16:15:15 2000
+++ Makefile	Wed Oct  4 18:49:26 2000
@@ -29,12 +29,33 @@
 
+# SSL support will be compiled in, unless NO_OPENSSL is defined, which
+# may be overturned by requesting WITH_SSL explicitly
+.if !defined(NO_OPENSSL) || defined(WITH_SSL)
+USE_OPENSSL=    yes
+CFLAGS+=	-DUSE_SSL
+WITH_SSL=	yes
+CONFIGURE_ENV+=	LDFLAGS="-L${OPENSSLLIB} -lssl -lcrypto"
+.endif
+
 # if you want to use the tcl/tk frontend pgaccess, then you need to build
-# postgresql with tcl support by typing: make -DWITH_TCL
+# postgresql with tcl support by typing: make WITH_TCL=<TCL.VERSION>
 .if defined(WITH_TCL)
-TCL_INCDIR=	${LOCALBASE}/include/tcl8.3
-TK_INCDIR=	${LOCALBASE}/include/tk8.3
+CONFIGURE_TCL=	--with-tcl --with-tclconfig="${TCLCONFIG}"
+.if ${WITH_TCL}==1
+WITH_TCL=8.3
+.endif
+TCLV=${WITH_TCL:S//}
+TCL_INCDIR=	${LOCALBASE}/include/tcl${WITH_TCL}
 MAKE_ENV=	TCL_INCDIR=${TCL_INCDIR}
-CONFIGURE_ENV=	WISH=${LOCALBASE}/bin/wish8.3
-LIB_DEPENDS=	tcl83.1:${PORTSDIR}/lang/tcl83 \
-		tk83.1:${PORTSDIR}/x11-toolkits/tk83
-CONFIGURE_TCL=	--with-tcl --with-tclconfig="${LOCALBASE}/lib/tcl8.3 ${LOCALBASE}/lib/tk8.3"
+LIB_DEPENDS=	tcl${TCLV}.1:${PORTSDIR}/lang/tcl${TCLV}
+TCLCONFIG=	'${LOCALBASE}/lib/tcl${WITH_TCL}'
+.if !defined(WITHOUT_TK)
+TK_INCDIR=	${LOCALBASE}/include/tk${WITH_TCL}
+CONFIGURE_ENV+=	WISH=${LOCALBASE}/bin/wish${WITH_TCL}
+LIB_DEPENDS+=	tk${TCLV}.1:${PORTSDIR}/x11-toolkits/tk${TCLV}
+TCLCONFIG+=	'${LOCALBASE}/lib/tk${WITH_TCL}'
+TCL_PLIST=	PLIST.tcl
+.else
+TCL_PLIST=	PLIST.tclnotk
+CONFIGURE_TCL+=	--without-tk
+.endif
 .endif
@@ -80,2 +101,3 @@
 		--enable-locale \
+		--enable-recode \
 		--with-template=`uname -s | ${TR} '[A-Z]' '[a-z]'` \
@@ -113,43 +135,55 @@
 pre-fetch:
-	@${ECHO_MSG} "To install and run postgresql you need to compile kernel with:"
-	@${ECHO_MSG} "    options    \"SYSVSHM, SYSVSEM, SYSVMSG\""
+	# To install and run postgresql you need to compile kernel with:
+	#     options    "SYSVSHM, SYSVSEM, SYSVMSG"
 .if !defined(WITH_TCL)
-	@${ECHO_MSG} "To build the \"PostgreSQL to Tcl interface library\", libpgtcl, type:"
-	@${ECHO_MSG} "    make -DWITH_TCL"
+	# To build the "PostgreSQL to Tcl interface library", libpgtcl, type:
+	#     make WITH_TCL=<TCL.VERSION> (like WITH_TCL=8.3)
+	# To disable build of TK-support (mainly -- pgaccess), add:
+	#     -DWITHOUT_TK
+.else
+	# Building PostgreSQL with libpgtcl.
+.if !defined(WITHOUT_TK)
+	# To disable build of TK-support (mainly -- pgaccess), add:
+	#     -DWITHOUT_TK
+.endif
+.endif
+.if defined(WITH_SSL)
+	# Building PostgreSQL with SSL support
 .else
-	@${ECHO_MSG} "Building PostgreSQL with \"libpgtcl\"."
+	# Although NO_OPENSSL is defined somewhere, you can force the port
+	# to try by adding -DWITH_SSL to the make's command line
 .endif
 .if !defined(WITHOUT_MULTIBYTE)
-	@${ECHO_MSG} "To disable multibyte support, type:"
-	@${ECHO_MSG} "    make -DWITHOUT_MULTIBYTE"
+	# To disable multibyte support, type:
+	#     make -DWITHOUT_MULTIBYTE
 .if !defined(DEFAULT_ENCODING)
-	@${ECHO_MSG} "To set the default encoding for the multibyte support, type:"
-	@${ECHO_MSG} "    make DEFAULT_ENCODING=<encoding>"
-	@${ECHO_MSG} "where <encoding> is one of these:"
-	@${ECHO_MSG} "    SQL_ASCII   LATIN1      LATIN2      LATIN3      LATIN4      LATIN5"
-	@${ECHO_MSG} "    EUC_JP      EUC_CN      EUC_KR      EUC_TW      KOI8"
-	@${ECHO_MSG} "    UNICODE     MULE_INTERNAL           WIN         ALT"
+	# To set the default encoding for the multibyte support, type:
+	#     make DEFAULT_ENCODING=<encoding>
+	# where <encoding> is one of these:
+	#     SQL_ASCII   LATIN1      LATIN2      LATIN3      LATIN4      LATIN5
+	#     EUC_JP      EUC_CN      EUC_KR      EUC_TW      KOI8
+	#     UNICODE     MULE_INTERNAL           WIN         ALT
 .else
-	@${ECHO_MSG} "The default encoding is '${DEFAULT_ENCODING}'."
+	# The default encoding is '${DEFAULT_ENCODING}'.
 .endif
 .else
-	@${ECHO_MSG} "Building PostgreSQL without multibyte support."
+	# Building PostgreSQL without multibyte support.
 .endif
 .if !defined(WITH_JDBC)
-	@${ECHO_MSG} "To build Java (JDBC) support, type:"
-	@${ECHO_MSG} "    make -DWITH_JDBC"
+	# To build Java (JDBC) support, type:
+	#     make -DWITH_JDBC
 .else
-	@${ECHO_MSG} "Building PostgreSQL with \"postgresql.jar\"."
+	# Building PostgreSQL with "postgresql.jar".
 .endif
 .if !defined(WITH_PERL)
-	@${ECHO_MSG} "To build Perl interface and pl/Perl interpreter:"
-	@${ECHO_MSG} "    make -DWITH_PERL"
+	# To build Perl interface and pl/Perl interpreter:"
+	#     make -DWITH_PERL"
 .else
-	@${ECHO_MSG} "Building PostgreSQL with \"pl/Perl\"."
+	# Building PostgreSQL with "pl/Perl".
 .endif
 .if !defined(WITH_ODBC)
-	@${ECHO_MSG} "To build the ODBC driver package:"
-	@${ECHO_MSG} "    make -DWITH_ODBC"
+	# To build the ODBC driver package:
+	#    make -DWITH_ODBC
 .else
-	@${ECHO_MSG} "Building PostgreSQL with ODBC Drivers."
+	# Building PostgreSQL with ODBC Drivers.
 .endif
@@ -168,12 +202,12 @@
 .if defined(WITH_JDBC)
-	@ cd ${WRKSRC}/interfaces/jdbc && ${GMAKE}
+	@ ${GMAKE} -C ${WRKSRC}/interfaces/jdbc
 .if !defined(NOPORTDOCS)
-	@ cd ${WRKSRC}/interfaces/jdbc && ${GMAKE} examples
+	@ ${GMAKE} -C ${WRKSRC}/interfaces/jdbc examples
 .endif
 .endif
-	@ ${ECHO} "------------------------------------------------------------"
-	@ ${ECHO} "Dump existing databases, before installing new db version !!"
-	@ ${ECHO} "Detailed instructions, see"
-	@ ${ECHO} "${WRKDIR}/${DISTNAME}/INSTALL"
-	@ ${ECHO} "------------------------------------------------------------"
+	# ------------------------------------------------------------
+	# Dump existing databases, before installing new db version !!
+	# Detailed instructions, see"
+	# ${WRKDIR}/${DISTNAME}/INSTALL"
+	# ------------------------------------------------------------
 
@@ -188,27 +222,10 @@
 .if defined(NOPORTDOCS)
-	@ ( cd ${DOCDIR}; ${GMAKE} man )
+	@ ${GMAKE} -C ${DOCDIR} man
 .else
-	@ ( cd ${DOCDIR}; ${GMAKE} install )
+	@ ${GMAKE} -C ${DOCDIR} install
 .endif
 	@ if [ ! -f ${PREFIX}/pgsql/.profile ]; then \
-		${ECHO} "PATH=${PATH}:${PREFIX}/pgsql/bin" \
+		${SED} 's|%%PREFIX%%|${PREFIX}|g' \
+			< ${FILESDIR}/dot.profile.in \
 			> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "MANPATH=${MANPATH}:${PREFIX}/pgsql/man" \
-			>> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "PGLIB=${PREFIX}/pgsql/lib" \
-			>> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "# note: PGDATA overwrites the -D startup option" \
-			>> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "PGDATA=${PREFIX}/pgsql/data" \
-			>> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "DISPLAY=:0" \
-			>> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "export PATH MANPATH PGLIB PGDATA DISPLAY" \
-			>> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "# if you want to make regression tests use this TZ" \
-			>> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "#TZ=PST8PDT" \
-			>> ${PREFIX}/pgsql/.profile; \
-		${ECHO} "#export TZ" \
-			>> ${PREFIX}/pgsql/.profile; \
 	fi
@@ -216,3 +233,3 @@
 	@ ${CHOWN} root:pgsql ${PREFIX}/pgsql/lib
-	@ ${ECHO} 'Initializing PostgreSQL Databases - this may take a few minutes...'
+	# Initializing PostgreSQL Databases - this may take a few minutes...
 	@ ${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m ${PREFIX}/pgsql/lib
@@ -230,9 +247,10 @@
 	@${CP} ${TMPPLIST} ${TMPPLIST}.notcl
-	@${CAT} ${PKGDIR}/PLIST.tcl ${TMPPLIST}.notcl > ${TMPPLIST}
+	@${CAT} ${PKGDIR}/${TCL_PLIST} ${TMPPLIST}.notcl > ${TMPPLIST}
 	@${RM} ${TMPPLIST}.notcl
-.endif
-.if defined(WITH_ODBC)
-	@${CP} ${TMPPLIST} ${TMPPLIST}.noodbc
-	@${CAT} ${PKGDIR}/PLIST.odbc ${TMPPLIST}.noodbc > ${TMPPLIST}
-	@${RM} ${TMPPLIST}.noodbc
+	# Preparing a loadable TCL-package (pkgIndex.tcl)
+	# XXX This directory and the single file are not registered in
+	# XXX the PLIST, because of different PREFIX.
+	@${MKDIR} -p ${LOCALBASE}/lib/tcl${WITH_TCL}/Pgtcl1.3
+	@${SED} 's|%%PREFIX%%|${PREFIX}|' < ${FILESDIR}/pkgIndex.tcl.in \
+		> ${LOCALBASE}/lib/tcl${WITH_TCL}/Pgtcl1.3/pkgIndex.tcl
 .endif
@@ -242,10 +260,15 @@
 			  ${PREFIX}/share/java/classes/postgresql.jar
-	@ ${ECHO_MSG} "---------------------------------------------------------"
-	@ ${ECHO_MSG} "Putting postgresql.jar in"
-	@ ${ECHO_MSG} "${PREFIX}/share/java/classes/postgresql.jar"
-	@ ${ECHO_MSG} "Add this to your CLASSPATH!"
-	@ ${ECHO_MSG} "ALSO NOTE: path inside jar file modified from 6.5.x:"
-	@ ${ECHO_MSG} "  'postgresql.*' -> 'org.postgresql.*'!"
-	@ ${ECHO_MSG} "You will need to modify you applications' props files."
-	@ ${ECHO_MSG} "---------------------------------------------------------"
+	# ---------------------------------------------------------"
+	# Putting postgresql.jar in"
+	# ${PREFIX}/share/java/classes/postgresql.jar"
+	# Add this to your CLASSPATH!"
+	# ALSO NOTE: path inside jar file modified from 6.5.x:"
+.endif
+.if defined(WITH_ODBC)
+	@${CP} ${TMPPLIST} ${TMPPLIST}.noodbc
+	@${CAT} ${PKGDIR}/PLIST.odbc ${TMPPLIST}.noodbc > ${TMPPLIST}
+	@${RM} ${TMPPLIST}.noodbc
+	#   'postgresql.*' -> 'org.postgresql.*'!"
+	# You will need to modify you applications' props files."
+	# ---------------------------------------------------------"
 	@ ${CAT} ${PKGDIR}/PLIST.jdbc >> ${TMPPLIST}
@@ -257,5 +280,5 @@
 			  ${PREFIX}/share/examples/pgsql/jdbc
-	@ ${ECHO_MSG} "---------------------------------------------------------"
-	@ ${ECHO_MSG} "Putting jdbc examples into ${PREFIX}/share/examples/pgsql"
-	@ ${ECHO_MSG} "---------------------------------------------------------"
+	# ---------------------------------------------------------"
+	# Putting jdbc examples into ${PREFIX}/share/examples/pgsql"
+	# ---------------------------------------------------------"
 	@ ${CAT} ${PKGDIR}/PLIST.doc >> ${TMPPLIST}
--- files/dot.profile.in	Wed Dec 31 19:00:00 1969
+++ files/dot.profile.in	Fri Sep 15 11:16:18 2000
@@ -0,0 +1,15 @@
+PATH=${PATH}:%%PREFIX%%/pgsql/bin
+MANPATH=${MANPATH}:%%PREFIX%%/pgsql/man
+PGLIB=%%PREFIX%%/pgsql/lib
+
+# note: PGDATA overwrites the -D startup option
+PGDATA=%%PREFIX%%/pgsql/data
+
+# not sure if you need this:
+DISPLAY=:0
+
+export PATH MANPATH PGLIB PGDATA # DISPLAY
+
+# if you want to make regression tests use this TZ
+#TZ=PST8PDT
+#export TZ
--- files/pgsql.sh.tmpl	Tue May 30 15:49:38 2000
+++ files/pgsql.sh.tmpl	Wed Oct  4 20:00:29 2000
@@ -19,3 +19,3 @@
     [ -x !!PREFIX!!/pgsql/bin/pg_ctl ] && {
-	su -l pgsql -c 'exec !!PREFIX!!/pgsql/bin/pg_ctl -w -m fast stop'
+	exec su -l pgsql -c 'exec !!PREFIX!!/pgsql/bin/pg_ctl -w -m fast stop'
     }
@@ -25,3 +25,3 @@
     [ -x !!PREFIX!!/pgsql/bin/pg_ctl ] && {
-	su -l pgsql -c 'exec !!PREFIX!!/pgsql/bin/pg_ctl status'
+	exec su -l pgsql -c 'exec !!PREFIX!!/pgsql/bin/pg_ctl status'
     }
--- files/pkgIndex.tcl.in	Wed Dec 31 19:00:00 1969
+++ files/pkgIndex.tcl.in	Fri Sep 15 11:12:35 2000
@@ -0,0 +1,4 @@
+# Package-index file for Pgtcl-package. Enables you to load PostgreSQL
+# interface functions right into you TCL-interpreter as simply as
+#	package require Pgtcl
+package ifneeded Pgtcl 1.3 "load %%PREFIX%%/lib/libpgtcl.so"
--- files/post-install-notes	Wed Jun 21 10:17:28 2000
+++ files/post-install-notes	Fri Oct  6 11:06:40 2000
@@ -10,5 +10,8 @@
 
-If you built PostgreSQL with TCL support, you can install the port
-"pgaccess" to get a TCL/TK based database frontend for database
-operations.
+If you built PostgreSQL with TCL/TK support, you can use the pgaccess
+utility to get a TCL/TK based database frontend for database
+operations. You do NOT need to install the pgaccess port separately.
+
+If you built in the TCL support, you can load the Pg package into your
+TCL scripts as easily as ``package require Pgtcl''.
 
--- patches/patch-ss	Wed Dec 31 19:00:00 1969
+++ patches/patch-ss	Fri Sep 15 13:57:07 2000
@@ -0,0 +1,17 @@
+--- interfaces/libpq/fe-connect.c	Sun May 21 17:19:53 2000
++++ interfaces/libpq/fe-connect.c	Fri Sep 15 13:53:52 2000
+@@ -801 +801 @@
+-			sprintf(conn->errorMessage,
++			printfPQExpBuffer(&conn->errorMessage,
+@@ -809 +809 @@
+-			sprintf(conn->errorMessage, "PQconnectDB() -- couldn't read postmaster response: errno=%d\n%s\n",
++			printfPQExpBuffer(&conn->errorMessage, "PQconnectDB() -- couldn't read postmaster response: errno=%d\n%s\n",
+@@ -822 +822 @@
+-					sprintf(conn->errorMessage,
++					printfPQExpBuffer(&conn->errorMessage,
+@@ -832 +832 @@
+-				sprintf(conn->errorMessage,
++				printfPQExpBuffer(&conn->errorMessage,
+@@ -850 +850 @@
+-			strcpy(conn->errorMessage,
++			printfPQExpBuffer(&conn->errorMessage,
--- patches/patch-st	Wed Dec 31 19:00:00 1969
+++ patches/patch-st	Fri Oct  6 10:59:41 2000
@@ -0,0 +1,45 @@
+This patches let you disable Tk even if you have it installed and
+makes sure the TCL-library is added as a dependency for libpgtcl.
+--- interfaces/libpgtcl/Makefile.in	Tue Mar  7 20:58:36 2000
++++ interfaces/libpgtcl/Makefile.in	Wed Sep 20 08:57:28 2000
+@@ -29,3 +29,3 @@
+ 
+-SHLIB_LINK+= $(LIBPQ)
++SHLIB_LINK+= $(LIBPQ) @TCL_LIB_SPEC@
+ 
+--- configure	Wed Sep 20 08:53:57 2000
++++ configure	Wed Sep 20 09:01:00 2000
+@@ -948,2 +948,17 @@
+ 
++if test USE_TCL = true
++then
++	echo $ac_n "checking setting USE_TK""... $ac_c" 1>&6
++	echo "configure:952: checking setting USE_TK" >&5
++	# Check whether --with-tk or --without-tk was given.
++	if test "${with_tk+set}" = set; then
++	  withval="$with_tk"
++	  
++		case "$withval" in
++		y | ye | yes)		USE_TK=true; echo "$ac_t""enabled" 1>&6 ;;
++		*)			USE_TK=n; echo "$ac_t""disabled" 1>&6 ;;
++		esac
++	fi
++fi
++
+ 
+@@ -7090,3 +7105,3 @@
+ 		echo "$ac_t""$TCL_CONFIG_SH" 1>&6
+-		
++		. ${TCL_CONFIG_SH}
+ 	fi
+@@ -7094,3 +7118,5 @@
+ 
+-USE_TK=$USE_TCL		# If TCL is disabled, disable TK
++USE_TK=${USE_TK:=$USE_TCL}		# If TCL is disabled, disable TK,
++					# otherwise -- enable unless explicitly
++					# disabled
+ 
+@@ -8359,2 +8385,3 @@
+ s%@expanded_libdir@%$expanded_libdir%g
++s%@TCL_LIB_SPEC@%$TCL_LIB_SPEC%g
+ 
--- pkg/PLIST.tclnotk	Wed Dec 31 19:00:00 1969
+++ pkg/PLIST.tclnotk	Fri Sep 15 10:37:37 2000
@@ -0,0 +1,6 @@
+pgsql/bin/pgtclsh
+pgsql/include/libpgtcl.h
+pgsql/lib/libpgtcl.a
+pgsql/lib/libpgtcl.so
+pgsql/lib/libpgtcl.so.2
+pgsql/lib/pltcl.so

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010061524.e96FOs775856>