Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / pgsql.buildlink3.mk
blobb3642baf359236427a63c01e2772e6d2be8a0272
1 # $NetBSD: pgsql.buildlink3.mk,v 1.34 2012/10/05 21:09:02 adam Exp $
3 # User-settable variables:
5 # PGSQL_VERSION_DEFAULT
7 # Package-settable variables:
9 # PGSQL_VERSIONS_ACCEPTED
11 # Variables set by this file:
13 # PG_LIB_EXT
14 # PGSQL_TYPE
15 # PGPKGSRCDIR
17 .if !defined(PGVERSION_MK)
18 PGVERSION_MK= defined
20 _VARGROUPS+= pgsql
21 _USER_VARS.pgsql= PGSQL_VERSION_DEFAULT
22 _PKG_VARS.pgsql= PGSQL_VERSIONS_ACCEPTED
23 _SYS_VARS.pgsql= PG_LIB_EXT PGSQL_TYPE PGPKGSRCDIR
25 .include "../../mk/bsd.prefs.mk"
27 PGSQL_VERSION_DEFAULT?= 91
28 PGSQL_VERSIONS_ACCEPTED?= 92 91 90 84
30 # transform the list into individual variables
31 .for pv in ${PGSQL_VERSIONS_ACCEPTED}
32 _PGSQL_VERSION_${pv}_OK= yes
33 .endfor
35 .if ${_OPSYS_SHLIB_TYPE} == "dylib"
36 PG_LIB_EXT=dylib
37 .else
38 PG_LIB_EXT=so
39 .endif
41 # check what is installed
42 .if ${OPSYS} == "Darwin"
43 . if exists(${LOCALBASE}/lib/libecpg.6.4.dylib)
44 _PGSQL_VERSION_92_INSTALLED= yes
45 . endif
46 . if exists(${LOCALBASE}/lib/libecpg.6.3.dylib)
47 _PGSQL_VERSION_91_INSTALLED= yes
48 . endif
49 . if exists(${LOCALBASE}/lib/libecpg.6.2.dylib)
50 _PGSQL_VERSION_90_INSTALLED= yes
51 . endif
52 . if exists(${LOCALBASE}/lib/libecpg.6.1.dylib)
53 _PGSQL_VERSION_84_INSTALLED= yes
54 . endif
55 .else
56 . if exists(${LOCALBASE}/lib/libecpg.so.6.4)
57 _PGSQL_VERSION_92_INSTALLED= yes
58 . endif
59 . if exists(${LOCALBASE}/lib/libecpg.so.6.3)
60 _PGSQL_VERSION_91_INSTALLED= yes
61 . endif
62 . if exists(${LOCALBASE}/lib/libecpg.so.6.2)
63 _PGSQL_VERSION_90_INSTALLED= yes
64 . endif
65 . if exists(${LOCALBASE}/lib/libecpg.so.6.1)
66 _PGSQL_VERSION_84_INSTALLED= yes
67 . endif
68 .endif
70 # if a version is explicitely required, take it
71 .if defined(PGSQL_VERSION_REQD)
72 _PGSQL_VERSION= ${PGSQL_VERSION_REQD}
73 .endif
74 # if the default is already installed, it is first choice
75 .if !defined(_PGSQL_VERSION)
76 .if defined(_PGSQL_VERSION_${PGSQL_VERSION_DEFAULT}_OK)
77 .if defined(_PGSQL_VERSION_${PGSQL_VERSION_DEFAULT}_INSTALLED)
78 _PGSQL_VERSION= ${PGSQL_VERSION_DEFAULT}
79 .endif
80 .endif
81 .endif
82 # prefer an already installed version, in order of "accepted"
83 .if !defined(_PGSQL_VERSION)
84 .for pv in ${PGSQL_VERSIONS_ACCEPTED}
85 .if defined(_PGSQL_VERSION_${pv}_INSTALLED)
86 _PGSQL_VERSION?= ${pv}
87 .else
88 # keep information as last resort - see below
89 _PGSQL_VERSION_FIRSTACCEPTED?= ${pv}
90 .endif
91 .endfor
92 .endif
93 # if the default is OK for the addon pkg, take this
94 .if !defined(_PGSQL_VERSION)
95 .if defined(_PGSQL_VERSION_${PGSQL_VERSION_DEFAULT}_OK)
96 _PGSQL_VERSION= ${PGSQL_VERSION_DEFAULT}
97 .endif
98 .endif
99 # take the first one accepted by the package
100 .if !defined(_PGSQL_VERSION)
101 _PGSQL_VERSION= ${_PGSQL_VERSION_FIRSTACCEPTED}
102 .endif
104 # set variables for the version we decided to use:
105 .if ${_PGSQL_VERSION} == "92"
106 PGSQL_TYPE= postgresql92-client
107 PGPKGSRCDIR= ../../databases/postgresql92-client
108 .elif ${_PGSQL_VERSION} == "91"
109 PGSQL_TYPE= postgresql91-client
110 PGPKGSRCDIR= ../../databases/postgresql91-client
111 .elif ${_PGSQL_VERSION} == "90"
112 PGSQL_TYPE= postgresql90-client
113 PGPKGSRCDIR= ../../databases/postgresql90-client
114 .elif ${_PGSQL_VERSION} == "84"
115 PGSQL_TYPE= postgresql84-client
116 PGPKGSRCDIR= ../../databases/postgresql84-client
117 .else
118 # force an error
119 PGSQL_TYPE= none
120 PKG_FAIL_REASON+= "${_PGSQL_VERSION} is not a valid package"
121 .endif
123 .include "${PGPKGSRCDIR}/buildlink3.mk"
124 PGSQL_PREFIX= ${BUILDLINK_PREFIX.${PGSQL_TYPE}}
126 PGSQL_VERSION= ${_PGSQL_VERSION}
128 .endif # PGVERSION_MK