postgresql.inc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. SUMMARY = "PostgreSQL is a powerful, open source relational database system."
  2. DESCRIPTION = "\
  3. PostgreSQL is an advanced Object-Relational database management system \
  4. (DBMS) that supports almost all SQL constructs (including \
  5. transactions, subselects and user-defined types and functions). The \
  6. postgresql package includes the client programs and libraries that \
  7. you'll need to access a PostgreSQL DBMS server. These PostgreSQL \
  8. client programs are programs that directly manipulate the internal \
  9. structure of PostgreSQL databases on a PostgreSQL server. These client \
  10. programs can be located on the same machine with the PostgreSQL \
  11. server, or may be on a remote machine which accesses a PostgreSQL \
  12. server over a network connection. This package contains the docs \
  13. in HTML for the whole package, as well as command-line utilities for \
  14. managing PostgreSQL databases on a PostgreSQL server. \
  15. \
  16. If you want to manipulate a PostgreSQL database on a local or remote \
  17. PostgreSQL server, you need this package. You also need to install \
  18. this package if you're installing the postgresql-server package. \
  19. "
  20. HOMEPAGE = "http://www.postgresql.com"
  21. LICENSE = "BSD-0-Clause"
  22. DEPENDS = "libnsl2 zlib readline tzcode-native"
  23. ARM_INSTRUCTION_SET = "arm"
  24. SRC_URI = "http://ftp.postgresql.org/pub/source/v${PV}/${BP}.tar.bz2 \
  25. file://postgresql.init \
  26. file://postgresql-profile \
  27. file://postgresql.pam \
  28. file://postgresql-setup \
  29. file://postgresql.service \
  30. "
  31. LEAD_SONAME = "libpq.so"
  32. # LDFLAGS for shared libraries
  33. export LDFLAGS_SL = "${LDFLAGS}"
  34. inherit autotools pkgconfig perlnative python3native useradd update-rc.d systemd gettext cpan-base
  35. CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR} -I${STAGING_INCDIR}/tcl8.6"
  36. SYSTEMD_SERVICE_${PN} = "postgresql.service"
  37. SYSTEMD_AUTO_ENABLE_${PN} = "disable"
  38. DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
  39. pkg_postinst_${PN} () {
  40. if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
  41. if [ -n "$D" ]; then
  42. OPTS="--root=$D"
  43. fi
  44. systemctl $OPTS mask postgresql-server.service
  45. fi
  46. }
  47. enable_pam = "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
  48. PACKAGECONFIG ??= "${enable_pam} openssl python uuid libxml tcl nls libxml perl"
  49. PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam,"
  50. PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl ac_cv_file__dev_urandom=yes,openssl,"
  51. PACKAGECONFIG[python] = "--with-python,--without-python,python3,python3"
  52. PACKAGECONFIG[uuid] = "--with-uuid=e2fs,--without-uuid,util-linux,"
  53. PACKAGECONFIG[tcl] = "--with-tcl --with-tclconfig=${STAGING_BINDIR_CROSS},--without-tcl,tcl tcl-native,"
  54. PACKAGECONFIG[nls] = "--enable-nls,--disable-nls,,"
  55. PACKAGECONFIG[libxml] = "--with-libxml,--without-libxml,libxml2,libxml2"
  56. PACKAGECONFIG[perl] = "--with-perl,--without-perl,perl,perl"
  57. EXTRA_OECONF += "--enable-thread-safety --disable-rpath \
  58. --datadir=${datadir}/${BPN} \
  59. --sysconfdir=${sysconfdir}/${BPN} \
  60. "
  61. EXTRA_OECONF_sh4 += "--disable-spinlocks"
  62. EXTRA_OECONF_aarch64 += "--disable-spinlocks"
  63. DEBUG_OPTIMIZATION_remove_mips = " -Og"
  64. DEBUG_OPTIMIZATION_append_mips = " -O"
  65. BUILD_OPTIMIZATION_remove_mips = " -Og"
  66. BUILD_OPTIMIZATION_append_mips = " -O"
  67. DEBUG_OPTIMIZATION_remove_mipsel = " -Og"
  68. DEBUG_OPTIMIZATION_append_mipsel = " -O"
  69. BUILD_OPTIMIZATION_remove_mipsel = " -Og"
  70. BUILD_OPTIMIZATION_append_mipsel = " -O"
  71. PACKAGES_DYNAMIC += "^${PN}-plperl \
  72. ^${PN}-pltcl \
  73. ^${PN}-plpython \
  74. "
  75. python populate_packages_prepend() {
  76. def fill_more(name):
  77. if name is None or name.strip() == "":
  78. return
  79. fpack=d.getVar('PACKAGES', False) or ""
  80. fpack="${PN}-" + name + " " + fpack
  81. d.setVar('PACKAGES', fpack)
  82. conf=(d.getVar('PACKAGECONFIG') or "").split()
  83. pack=d.getVar('PACKAGES', False) or ""
  84. bb.debug(1, "PACKAGECONFIG=%s" % conf)
  85. bb.debug(1, "PACKAGES1=%s" % pack )
  86. if "perl" in conf :
  87. fill_more("plperl")
  88. if "tcl" in conf:
  89. fill_more("pltcl")
  90. if "python" in conf:
  91. fill_more("plpython")
  92. pack=d.getVar('PACKAGES') or ""
  93. bb.debug(1, "PACKAGES2=%s" % pack)
  94. }
  95. # This will make native perl use target settings (for include dirs etc.)
  96. export PERLCONFIGTARGET = "${@is_target(d)}"
  97. export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
  98. do_configure() {
  99. # do_configure
  100. autotools_do_configure
  101. # do_configure_append
  102. # workaround perl package related bugs
  103. sed -i -e "s:-L/usr/local/lib:-L=/usr/local/lib:g" \
  104. ${B}/src/Makefile.global
  105. LIBPNA="\${STAGING_LIBDIR_NATIVE}/perl-native"
  106. LIBNA="\${STAGING_LIBDIR_NATIVE}"
  107. BLIBNA="\${STAGING_BASE_LIBDIR_NATIVE}"
  108. sed -i -e "/^perl_archlibexp/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
  109. ${B}/src/Makefile.global
  110. sed -i -e "/^perl_privlibexp/s:${libdir}:${STAGING_LIBDIR}:g" \
  111. ${B}/src/Makefile.global
  112. # remove the rpath, replace with correct lib path
  113. sed -i \
  114. -e "/^perl_embed_ldflags/s:-Wl,-rpath,${LIBNA}::g" \
  115. -e "/^perl_embed_ldflags/s:-Wl,-rpath,${BLIBNA}::g" \
  116. -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${LIBNA}::g" \
  117. -e "/^perl_embed_ldflags/s:-Wl,-rpath-link,${BLIBNA}::g" \
  118. -e "/^perl_embed_ldflags/s:${LIBPNA}:${STAGING_LIBDIR}:g" \
  119. -e "/^perl_embed_ldflags/s:${LIBNA}:${STAGING_LIBDIR}:g" \
  120. -e "/^perl_embed_ldflags/s:${BLIBNA}:${STAGING_BASELIBDIR}:g" \
  121. -e "/^TCLSH/s:=.*:= ${bindir}/tclsh:g" \
  122. ${B}/src/Makefile.global
  123. if ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'true', 'false', d)}; then
  124. # workaround perl package's libperl.so problem
  125. # we are using perlnative so this perl should have same version
  126. perl_version=`perl -v 2>/dev/null | \
  127. sed -n 's/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p'`
  128. if [ ! -h "${STAGING_LIBDIR}/perl/$perl_version/CORE/libperl.so" -a \
  129. ! -h "${STAGING_LIBDIR}/libperl.so" ]; then
  130. ln -sf ../../../libperl.so.5 \
  131. ${STAGING_LIBDIR}/perl/$perl_version/CORE/libperl.so
  132. fi
  133. fi
  134. }
  135. do_compile_append() {
  136. oe_runmake -C contrib all
  137. }
  138. # server needs to configure user and group
  139. usernum = "28"
  140. groupnum = "28"
  141. USERADD_PACKAGES = "${PN}"
  142. USERADD_PARAM_${PN} = "-M -g postgres -o -r -d ${localstatedir}/lib/${BPN} \
  143. -s /bin/sh -c 'PostgreSQL Server' -u ${usernum} postgres"
  144. GROUPADD_PARAM_${PN} = "-g ${groupnum} -o -r postgres"
  145. INITSCRIPT_PACKAGES = "${PN}"
  146. INITSCRIPT_NAME = "${BPN}-server"
  147. INITSCRIPT_PARAMS = "start 64 . stop 36 0 1 2 3 4 5 6 ."
  148. do_install_append() {
  149. # install contrib
  150. oe_runmake DESTDIR=${D} -C contrib install
  151. # install tutorial
  152. install -d -m 0755 ${D}${libdir}/${BPN}/tutorial
  153. install ${B}/src/tutorial/* ${D}${libdir}/${BPN}/tutorial
  154. # install COPYRIGHT README HISTORY
  155. install -d -m 0755 ${D}${docdir}/${BPN}
  156. for i in ${B}/COPYRIGHT ${B}/README ${B}/HISTORY ${B}/doc/KNOWN_BUGS ${B}/doc/MISSING_FEATURES ${B}/doc/README* ${B}/doc/bug.template; do
  157. [ -f $i ] && install $i ${D}${docdir}/${BPN}
  158. done
  159. # install dirs and server init
  160. install -d ${D}${sysconfdir}/init.d
  161. install -m 0755 ${WORKDIR}/${BPN}.init ${D}${sysconfdir}/init.d/${BPN}-server
  162. sed -i -e "s/^PGVERSION=.*$/PGVERSION=${PV}/g" ${D}${sysconfdir}/init.d/${BPN}-server
  163. install -m 0755 ${WORKDIR}/${BPN}-setup ${D}${bindir}/${BPN}-setup
  164. install -d -m 700 ${D}${localstatedir}/lib/${BPN}/data
  165. install -d -m 700 ${D}${localstatedir}/lib/${BPN}/backups
  166. install -m 644 ${WORKDIR}/${BPN}-profile ${D}${localstatedir}/lib/${BPN}/.profile
  167. chown -R postgres:postgres ${D}${localstatedir}/lib/${BPN}
  168. # multiple server config directory
  169. install -d -m 700 ${D}${sysconfdir}/default/${BPN}
  170. if [ "${@d.getVar('enable_pam')}" = "pam" ]; then
  171. install -d ${D}${sysconfdir}/pam.d
  172. install -m 644 ${WORKDIR}/postgresql.pam ${D}${sysconfdir}/pam.d/postgresql
  173. fi
  174. # Install systemd unit files
  175. install -d ${D}${systemd_unitdir}/system
  176. install -m 0644 ${WORKDIR}/postgresql.service ${D}${systemd_unitdir}/system
  177. sed -i -e 's,@BINDIR@,${bindir},g' \
  178. ${D}${systemd_unitdir}/system/postgresql.service
  179. }
  180. SSTATE_SCAN_FILES += "Makefile.global"
  181. SSTATE_SCAN_FILES_remove = "*_config"
  182. PACKAGES =+ "${PN}-client ${PN}-server-dev ${PN}-timezone \
  183. libecpg-compat libecpg-compat-dev \
  184. libecpg libecpg-dev libecpg-staticdev libecpg-doc \
  185. libpq libpq-dev libpq-staticdev \
  186. libpgtypes libpgtypes-staticdev libpgtypes-dev \
  187. ${PN}-contrib \
  188. "
  189. RPROVIDES_${PN}-dbg += "libecpg-compat-dbg \
  190. libecpg-dbg \
  191. libpq-dbg \
  192. libpgtypes-dbg \
  193. ${PN}-contrib-dbg \
  194. ${PN}-pltcl-dbg \
  195. ${PN}-plpython-dbg \
  196. ${PN}-plperl-dbg \
  197. "
  198. FILES_${PN} += "${sysconfdir}/init.d/${BPN}-server \
  199. ${localstatedir}/lib/${BPN}/data ${localstatedir}/lib/${BPN}/backups \
  200. ${localstatedir}/lib/${BPN}/.profile ${sysconfdir}/default/${BPN} \
  201. ${libdir}/${BPN}/dict_snowball.so ${libdir}/${BPN}/plpgsql.so \
  202. ${libdir}/${BPN}/euc2004_sjis2004.so \
  203. ${libdir}/${BPN}/libpqwalreceiver.so \
  204. ${libdir}/${BPN}/*_and_*.so \
  205. ${@'${sysconfdir}/pam.d/postgresql' \
  206. if 'pam' == d.getVar('enable_pam') \
  207. else ''} \
  208. "
  209. FILES_${PN}-client = "${bindir}/clusterdb \
  210. ${bindir}/createdb \
  211. ${bindir}/createuser \
  212. ${bindir}/dropdb \
  213. ${bindir}/dropuser \
  214. ${bindir}/pg_dump \
  215. ${bindir}/pg_dumpall \
  216. ${bindir}/pg_restore \
  217. ${bindir}/psql \
  218. ${bindir}/reindexdb \
  219. ${bindir}/vacuumdb \
  220. ${bindir}/vacuumlo \
  221. ${datadir}/${BPN}/psqlrc.sample \
  222. "
  223. FILES_${PN}-client-doc = "${mandir}/man1/clusterdb.* \
  224. ${mandir}/man1/createdb.* ${mandir}/man1/createlang.* \
  225. ${mandir}/man1/createuser.* ${mandir}/man1/dropdb.* \
  226. ${mandir}/man1/droplang.* ${mandir}/man1/dropuser.* \
  227. ${mandir}/man1/pg_dump.* ${mandir}/man1/pg_dumpall.* \
  228. ${mandir}/man1/pg_restore.* ${mandir}/man1/psql.* \
  229. ${mandir}/man1/reindexdb.* ${mandir}/man1/vacuumdb.* \
  230. ${mandir}/man7/* \
  231. "
  232. FILES_${PN}-doc += "${docdir}/${BPN}/html ${libdir}/${BPN}/tutorial/ \
  233. ${mandir}/man1/initdb.* ${mandir}/man1/pg_controldata.* \
  234. ${mandir}/man1/pg_ctl.* ${mandir}/man1/pg_resetxlog.* \
  235. ${mandir}/man1/postgres.* ${mandir}/man1/postmaster.* \
  236. "
  237. FILES_${PN}-timezone = "${datadir}/${BPN}/timezone \
  238. ${datadir}/${BPN}/timezonesets \
  239. "
  240. RDEPENDS_${PN} += "${PN}-timezone"
  241. FILES_${PN}-server-dev = "${includedir}/${BPN}/server \
  242. ${libdir}/${BPN}/pgxs \
  243. "
  244. FILES_libecpg = "${libdir}/libecpg*${SOLIBS}"
  245. FILES_libecpg-dev = "${libdir}/libecpg*${SOLIBSDEV} \
  246. ${libdir}/libpgtypes*${SOLIBSDEV} \
  247. ${includedir}/ecpg*.h ${includedir}/${BPN}/ecpg*.h \
  248. ${includedir}/pgtypes*.h ${includedir}/${BPN}/informix \
  249. ${includedir}/sql3types.h ${includedir}/sqlca.h \
  250. "
  251. FILES_libecpg-doc = "${mandir}/man1/ecpg.*"
  252. FILES_libecpg-staticdev = "${libdir}/libecpg*.a"
  253. SECTION_libecpg-staticdev = "devel"
  254. RDEPENDS_libecpg-staticdev = "libecpg-dev (= ${EXTENDPKGV})"
  255. FILES_libpq = "${libdir}/libpq*${SOLIBS}"
  256. FILES_libpq-dev = "${libdir}/libpq*${SOLIBSDEV} \
  257. ${includedir} \
  258. "
  259. FILES_libpq-staticdev = "${libdir}/libpq*.a ${libdir}/libpgport.a"
  260. SECTION_libpq-staticdev = "devel"
  261. RDEPENDS_libpq-staticdev = "libpq-dev (= ${EXTENDPKGV})"
  262. FILES_libecpg-compat = "${libdir}/libecpg_compat*${SOLIBS}"
  263. FILES_libecpg-compat-dev = "${libdir}/libecpg_compat*${SOLIBS}"
  264. FILES_libpgtypes = "${libdir}/libpgtypes*${SOLIBS}"
  265. FILES_libpgtypes-staticdev = "${libdir}/libpgtypes*.a"
  266. FILES_libpgtypes-dev = "${libdir}/libpgtypes*${SOLIBS} ${includedir}/pgtypes*.h"
  267. FILES_${PN}-contrib = " ${bindir}/oid2name ${bindir}/pg_standby \
  268. ${bindir}/pgbench \
  269. ${S}/contrib/spi/*.example \
  270. ${libdir}/${BPN}/_int.so ${libdir}/${BPN}/adminpack.so \
  271. ${libdir}/${BPN}/autoinc.so ${libdir}/${BPN}/auto_explain.so \
  272. ${libdir}/${BPN}/auth_delay.so ${libdir}/${BPN}/btree_gin.so \
  273. ${libdir}/${BPN}/btree_gist.so ${libdir}/${BPN}/.so \
  274. ${libdir}/${BPN}/chkpass.so ${libdir}/${BPN}/citext.so \
  275. ${libdir}/${BPN}/cube.so ${libdir}/${BPN}/dblink.so \
  276. ${libdir}/${BPN}/dict_int.so ${libdir}/${BPN}/dict_xsyn.so \
  277. ${libdir}/${BPN}/dummy_seclabel.so ${libdir}/${BPN}/earthdistance.so \
  278. ${libdir}/${BPN}/file_fdw.so ${libdir}/${BPN}/fuzzystrmatch.so \
  279. ${libdir}/${BPN}/hstore.so ${libdir}/${BPN}/insert_username.so \
  280. ${libdir}/${BPN}/isn.so ${libdir}/${BPN}/lo.so \
  281. ${libdir}/${BPN}/ltree.so ${libdir}/${BPN}/moddatetime.so \
  282. ${libdir}/${BPN}/pageinspect.so ${libdir}/${BPN}/pg_buffercache.so \
  283. ${libdir}/${BPN}/pg_freespacemap.so ${libdir}/${BPN}/pg_trgm.so \
  284. ${libdir}/${BPN}/pgcrypto.so ${libdir}/${BPN}/pgrowlocks.so \
  285. ${libdir}/${BPN}/pgstattuple.so ${libdir}/${BPN}/pg_stat_statements.so \
  286. ${libdir}/${BPN}/refint.so ${libdir}/${BPN}/seg.so \
  287. ${libdir}/${BPN}/sslinfo.so \
  288. ${libdir}/${BPN}/tablefunc.so \
  289. ${libdir}/${BPN}/test_parser.so ${libdir}/${BPN}/timetravel.so \
  290. ${libdir}/${BPN}/uuid-ossp.so \
  291. ${libdir}/${BPN}/pgxml.so ${libdir}/${BPN}/passwordcheck.so \
  292. ${libdir}/${BPN}/pg_upgrade_support.so ${libdir}/${BPN}/.so \
  293. ${libdir}/${BPN}/unaccent.so \
  294. "
  295. DESCRIPTION_${PN}-contrib = "The postgresql-contrib package contains \
  296. contributed packages that are included in the PostgreSQL distribution."
  297. FILES_${PN}-pltcl = "${libdir}/${BPN}/pltcl.so ${bindir}/pltcl_delmod \
  298. ${binddir}/pltcl_listmod ${bindir}/pltcl_loadmod \
  299. ${datadir}/${BPN}/unknown.pltcl"
  300. SUMMARY_${PN}-pltcl = "The Tcl procedural language for PostgreSQL"
  301. DESCRIPTION_${PN}-pltcl = "PostgreSQL is an advanced Object-Relational \
  302. database management system. The postgresql-pltcl package contains the PL/Tcl \
  303. procedural language for the backend."
  304. FILES_${PN}-plperl = "${libdir}/${BPN}/plperl.so"
  305. SUMMARY_${PN}-plperl = "The Perl procedural language for PostgreSQL"
  306. DESCRIPTION_${PN}-plperl = "PostgreSQL is an advanced Object-Relational \
  307. database management system. The postgresql-plperl package contains the \
  308. PL/Perl procedural language for the backend."
  309. # In version 8, it will be plpython.so
  310. # In version 9, it might be plpython{2,3}.so depending on python2 or 3
  311. FILES_${PN}-plpython = "${libdir}/${BPN}/plpython*.so"
  312. SUMMARY_${PN}-plpython = "The Python procedural language for PostgreSQL"
  313. DESCRIPTION_${PN}-plpython = "PostgreSQL is an advanced Object-Relational \
  314. database management system. The postgresql-plpython package contains \
  315. the PL/Python procedural language for the backend."