summaryrefslogtreecommitdiff
path: root/japanese/postgresql-tcltk/Makefile
blob: 31db55929a7c5fb010e7b523f83bedd60fe157a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# New ports collection makefile for:	PostgreSQL-j
# Version required:	6.3.2+Multibyte-patch
# Date created:		20 Aug 1998
# Whom:			Ichiro Fukuhara <ichiro@ichiro.org>
#
# $Id: Makefile,v 1.2 1998/09/28 10:30:52 asami Exp $
#

DISTNAME=	postgresql-6.3.2
PKGNAME=	ja-postgresql-6.3.2
CATEGORIES=	japanese databases
MASTER_SITES=	ftp://ftp.postgresql.org/pub/ \
		ftp://ftp.jaist.ac.jp/pub/dbms/PostgreSQL/ \
		ftp://ftp.sra.co.jp/pub/cmd/postgres/6.3.2/

PATCH_SITES=	ftp://ftp.sra.co.jp/pub/cmd/postgres/6.3.2/patches/FreeBSD/
PATCHFILES=	jumbo_981104.patch.gz

MAINTAINER=	ichiro@ichiro.org

WRKSRC=		${WRKDIR}/${DISTNAME}/src
PATCH_DIST_ARGS=	-d ${WRKDIR}/${DISTNAME} --forward --quiet -E -p1

# if you want to use the tcl/tk frontend pgaccess, then you need to build
# postgresql with tcl support by typing: make USE_TCL=yes
.if defined(USE_TCL)
MAKE_ENV=	USE_TCL=true TCL_INCDIR=${PREFIX}/include/tcl7.6
LIB_DEPENDS=	tcl76jp.1:${PORTSDIR}/japanese/tcl76 \
		tk42jp.1:${PORTSDIR}/japanese/tk42
WITH_TCL=	--with-tcl
PLIST=		${PKGDIR}/PLIST.tcl
.endif

NO_PACKAGE=	"Requires ${PGSQL_UID} uid"

USE_GMAKE=	YES
MAKEFILE=	GNUmakefile
HAS_CONFIGURE=	YES
CONFIGURE_ARGS= --prefix=${PREFIX}/${INSTALL_DIR} \
		--with-template=`uname -s | ${TR} '[A-Z]' '[a-z]'` \
		--with-includes=${PREFIX}/include ${WITH_TCL} \
		--with-libraries=${PREFIX}/lib --with-mb=EUC_JP

MAN1=		cleardbdir.1 createdb.1 createuser.1 destroydb.1 \
		destroyuser.1 ecpg.1 initdb.1 ipcclean.1 initlocation.1 \
		pg_dump.1 pg_dumpall.1 pg_passwd.1 pgintro.1 postgres.1 \
		postmaster.1 psql.1
MAN3=		catalogs.3 large_objects.3 libpq.3 oracle_compat.3 pgbuiltin.3
MAN5=		bki.5 page.5 pg_hba.conf.5
MANL=		abort.l alter_table.l alter_user.l begin.l close.l cluster.l \
		commit.l copy.l create_aggregate.l create_database.l \
		create_function.l create_index.l create_language.l \
		create_operator.l create_rule.l create_sequence.l \
		create_table.l create_trigger.l create_type.l create_user.l \
		create_version.l create_view.l declare.l delete.l drop.l \
		drop_aggregate.l drop_database.l drop_function.l drop_index.l \
		drop_language.l drop_operator.l drop_rule.l drop_sequence.l \
		drop_table.l drop_trigger.l drop_type.l drop_user.l \
		drop_view.l end.l explain.l fetch.l grant.l insert.l listen.l \
		load.l lock.l move.l notify.l reset.l revoke.l \
		rollback.l select.l set.l show.l sql.l update.l vacuum.l

MANPREFIX=	${PREFIX}/${INSTALL_DIR}

PLIST_SUB=	INSTALL_DIR=${INSTALL_DIR}

# These values are easily overridable like as
#   "make PGQL_UID=postgresql PGSQL_GID=postgresql install"
INSTALL_DIR= 	pgsql
PGSQL_UID=	pgsql
PGSQL_GID=	pgsql

pre-fetch:
.if !defined(USE_TCL)
	@${ECHO_MSG} "To build the \"PostgreSQL to Tcl interface library\", libpgtcl, type:"
	@${ECHO_MSG} "    make USE_TCL=yes"
.else
	@${ECHO_MSG} "Building PostgreSQL with \"libpgtcl\"."
.endif

post-patch:
	find ${WRKDIR} -name '*.orig' -exec ${RM} {} \;

post-build:
	@ ${ECHO} "------------------------------------------------------------"
	@ ${ECHO} "Dump existing databases, before installing new db version !!"
	@ ${ECHO} "Detailed instructions, see INSTALL file under ${WRKDIR}...  "
	@ ${ECHO} "------------------------------------------------------------"

pre-install:
.if defined(PACKAGE_BUILDING)
	${RM} -rf ${PREFIX}/${INSTALL_DIR}
.endif
	@ ${MKDIR} ${PREFIX}/${INSTALL_DIR}
	@ ${SED} "s=PGSQL_UID=${PGSQL_UID}=g ; s=PGSQL_GID=${PGSQL_GID}=g ; \
		s=INSTALL_DIR=${INSTALL_DIR}=g" < ${SCRIPTDIR}/createuser.tmpl \
		> ${WRKDIR}/createuser
	@ ${SETENV} ${MAKE_ENV} perl ${WRKDIR}/createuser

post-install:
	@ if [ ! -f ${PREFIX}/${INSTALL_DIR}/.profile ]; then \
		${ECHO} "PATH=${PATH}:${PREFIX}/${INSTALL_DIR}/bin" \
			> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "MANPATH=${MANPATH}:${PREFIX}/${INSTALL_DIR}/bin" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "PGLIB=${PREFIX}/${INSTALL_DIR}/lib" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "# note: PGDATA overwrites the -D startup option" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "PGDATA=${PREFIX}/${INSTALL_DIR}/data" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "DISPLAY=:0" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "export PATH MANPATH PGLIB PGDATA DISPLAY" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "# if you want to make regression tests use this TZ" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "#TZ=PST8PDT" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
		${ECHO} "#export TZ" \
			>> ${PREFIX}/${INSTALL_DIR}/.profile; \
	fi
	@ chown -R ${PGSQL_UID}:${PGSQL_GID} ${PREFIX}/${INSTALL_DIR}
	@ ${ECHO} 'Initializing PostgreSQL Databases - this may take a few minutes...'
	@ ${LDCONFIG} -m ${PREFIX}/${INSTALL_DIR}/lib
	@ su -l ${PGSQL_UID} -c '${PREFIX}/${INSTALL_DIR}/bin/initdb --pglib=${PREFIX}/${INSTALL_DIR}/lib --pgdata=${PREFIX}/${INSTALL_DIR}/data'
	@ ${SED} "s=!!PG_PATH!!=${PREFIX}/${INSTALL_DIR}=g ; s=!!PGSQL_UID!!=${PGSQL_UID}=g" \
		< ${FILESDIR}/pgsql.sh.tmpl > ${PREFIX}/etc/rc.d/pgsql.sh
	@ chmod 554 ${PREFIX}/etc/rc.d/pgsql.sh
	@ chown root.${PGSQL_GID} ${PREFIX}/etc/rc.d/pgsql.sh
	@ ${INSTALL_DATA} ${FILESDIR}/post-install-notes ${PREFIX}/${INSTALL_DIR}
.if !defined(NOPORTDOCS)
	${MKDIR} ${PREFIX}/share/doc/${INSTALL_DIR}
	${CP} -r ${WRKDIR}/${DISTNAME}/doc/* ${PREFIX}/share/doc/${INSTALL_DIR}
.endif
.if !defined(BATCH)
	@ more -e ${FILESDIR}/post-install-notes
.endif

.include <bsd.port.mk>