ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/mports/trunk/Mk/extensions/pgsql.mk
Revision: 24373
Committed: Mon Sep 24 23:07:21 2018 UTC (5 years, 7 months ago) by laffer1
File size: 4528 byte(s)
Log Message:
fixup pg version check

File Contents

# Content
1 # $MidnightBSD$
2
3 .if !defined(_INCLUDE_USES_PGSQL_MK)
4
5 _INCLUDE_USES_PGSQL_MK= yes
6
7 # Variables set by pgsql.mk:
8 #
9 # PGSQL_VER
10 # Detected PostgreSQL version. Do *not* use this
11 # to add dependencies; use WANT_PGSQL as explained above
12 #
13
14 # When adding a version, please keep the comment in
15 # Mk/bsd.default-versions.mk in sync.
16 VALID_PGSQL_VER= 9.3 9.4 9.5 9.6 10
17
18 # Override non-default LIBVERS like this:
19 #PGSQL99_LIBVER=6
20
21 PGSQL_LIBVER= 5
22 .for v in ${VALID_PGSQL_VER:S,.,,}
23 PGSQL$v_LIBVER?= ${PGSQL_LIBVER}
24 .endfor
25
26 .for v in ${PGSQL_DEFAULT}
27 . if ! ${VALID_PGSQL_VER:M$v}
28 IGNORE= Invalid PGSQL default version ${PGSQL_DEFAULT}; valid versions are ${VALID_PGSQL_VER}
29 . endif
30 .endfor
31
32 . for w in WITH DEFAULT
33 . ifdef $w_PGSQL_VER
34 WARNING+= "$w_PGSQL_VER is defined, consider using DEFAULT_VERSIONS=pgsql=${$w_PGSQL_VER:C,^.,&.,} instead"
35 PGSQL_DEFAULT?= ${$w_PGSQL_VER:C,^.,&.,}
36 . endif
37 . endfor
38
39 . ifdef DEFAULT_PGSQL_VER && WITH_PGSQL_VER
40 IGNORE= will not allow setting both DEFAULT_PGSQL_VER and WITH_PGSQL_VER. Use DEFAULT_VERSIONS=pgsql=9.6 instead
41 . endif
42
43 # Setting/finding PostgreSQL version we want.
44 PG_CONFIG?= ${LOCALBASE}/bin/pg_config
45 . if exists(${PG_CONFIG})
46 _PGSQL_VER!= ${PG_CONFIG} --version | ${SED} -n 's/PostgreSQL[^0-9]*\([0-9]\.*[0-9]\).*/\1/p'
47 . endif
48
49 # Handle the + and - version stuff
50 . if !empty(pgsql_ARGS)
51 . if ${pgsql_ARGS:M*+}
52 . for version in ${VALID_PGSQL_VER}
53 . if ${pgsql_ARGS:S/+//} <= ${version}
54 _WANT_PGSQL_VER+=${version}
55 . endif
56 . endfor
57 . elif ${pgsql_ARGS:M*-}
58 . for version in ${VALID_PGSQL_VER}
59 . if ${pgsql_ARGS:S/-//} >= ${version}
60 _WANT_PGSQL_VER+=${version}
61 . endif
62 . endfor
63 . endif
64 _WANT_PGSQL_VER?= ${pgsql_ARGS}
65 . endif
66
67 # Try to match default version, otherwise just take the first version
68 # that matches. Prefer the installed version if it matches
69 . if !empty(_WANT_PGSQL_VER)
70 . for version in ${_WANT_PGSQL_VER}
71 . if ${PGSQL_DEFAULT} == ${version}
72 PGSQL_VER= ${version}
73 . endif
74 PGSQL_VER?= ${version}
75 . endfor
76 . if defined(_PGSQL_VER)
77 . for v in ${_PGSQL_VER}
78 . if ${_WANT_PGSQL_VER:M$v} == ${_PGSQL_VER}
79 PGSQL_VER= ${_PGSQL_VER}
80 . endif
81 . endfor
82 . endif
83 . if defined(_PGSQL_VER) && ${_PGSQL_VER} != ${PGSQL_VER}
84 IGNORE?= cannot install: the port wants postgresql-client version ${_WANT_PGSQL_VER} and you have version ${_PGSQL_VER} installed
85 . endif
86 . endif
87
88 # OK, so the port is ambivalent, we'll just take what's on the system.
89 PGSQL_VER?= ${_PGSQL_VER}
90
91 # After all that, we still have found nothing!
92 . if empty(PGSQL_VER)
93 PGSQL_VER= ${PGSQL_DEFAULT}
94 . endif
95
96 # We don't want to be :S,.,, the whole time when doing port version checks
97 PGSQL_VER_NODOT= ${PGSQL_VER:S,.,,}
98
99 # And now we are checking if we can use it
100 . if defined(PGSQL${PGSQL_VER_NODOT}_LIBVER)
101 # Compat. Please DO NOT use IGNORE_WITH_PGSQL!
102 . if defined(IGNORE_WITH_PGSQL)
103 DEV_WARNING+= "Do not set IGNORE_WITH_PGSQL, use the version argument to USES=pgsql"
104 . for ver in ${IGNORE_WITH_PGSQL}
105 . if (${PGSQL_VER} == ${ver})
106 IGNORE?= cannot install: does not work with postgresql${PGSQL_VER_NODOT}-client (PostgreSQL ${IGNORE_WITH_PGSQL} not supported)
107 . endif
108 . endfor
109 . endif # IGNORE_WITH_PGSQL
110
111 .if !defined(WANT_PGSQL) || ${WANT_PGSQL:Mlib}
112 LIB_DEPENDS+= libpq.so.${PGSQL${PGSQL_VER_NODOT}_LIBVER}:databases/postgresql${PGSQL_VER_NODOT}-client
113 .endif
114
115 _USE_PGSQL_DEP= client contrib docs pgtcl pltcl plperl server
116 _USE_PGSQL_DEP_client= psql
117 _USE_PGSQL_DEP_contrib= vacuumlo
118 _USE_PGSQL_DEP_docs= postgresql${PGSQL_VER_NODOT}-docs>0
119 _USE_PGSQL_DEP_pgtcl= ${LOCALBASE}/lib/pgtcl/pkgIndex.tcl
120 _USE_PGSQL_DEP_plperl= postgresql${PGSQL_VER_NODOT}-plperl>0
121 _USE_PGSQL_DEP_pltcl= postgresql${PGSQL_VER_NODOT}-pltcl>0
122 _USE_PGSQL_DEP_server= postgres
123 . if defined(WANT_PGSQL)
124 . for depend in ${_USE_PGSQL_DEP}
125 . if ${WANT_PGSQL:M${depend}}
126 BUILD_DEPENDS+= ${_USE_PGSQL_DEP_${depend}}:databases/postgresql${PGSQL_VER_NODOT}-${depend}
127 RUN_DEPENDS+= ${_USE_PGSQL_DEP_${depend}}:databases/postgresql${PGSQL_VER_NODOT}-${depend}
128 . elif ${WANT_PGSQL:M${depend}\:*}
129 BUILD_DEPENDS+= ${NONEXISTENT}:databases/postgresql${PGSQL_VER_NODOT}-${depend}:${WANT_PGSQL:M${depend}\:*:C,^[^:]*\:,,}
130 . endif
131 . endfor
132 . endif
133
134 . else
135 IGNORE?= cannot install: unknown PostgreSQL version: ${PGSQL_VER}
136 . endif # Check for correct version
137 CPPFLAGS+= -I${LOCALBASE}/include
138 LDFLAGS+= -L${LOCALBASE}/lib
139
140 .endif # !defined(_INCLUDE_USES_PGSQL_MK)

Properties

Name Value
svn:keywords MidnightBSD=%H