PKGBUILD 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. # Maintainer (Arch):
  2. # Contributor (Artix): artoo <artoo@cromnix.org>
  3. # Maintainer: André Silva <emulatorman@hyperbola.info>
  4. pkgbase=openldap
  5. pkgname=('openldap' 'libldap')
  6. pkgver=2.4.50
  7. _debver=2.4.50+dfsg
  8. _debrel=1
  9. pkgrel=3
  10. arch=('i686' 'x86_64')
  11. url="https://www.openldap.org/"
  12. license=('OpenLDAP-2.8')
  13. makedepends=('libtool' 'libsasl' 'e2fsprogs' 'util-linux' 'chrpath' 'unixodbc' 'quilt')
  14. options=('!makeflags' 'emptydirs')
  15. source=(https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pkgbase}-${pkgver}.tgz
  16. https://deb.debian.org/debian/pool/main/o/openldap/openldap_$_debver-$_debrel.debian.tar.xz
  17. openldap-ntlm.patch slapd.initd slapd.conf slapd.run)
  18. sha512sums=('f528043ff9de36f7b65d8816c9a9c24f0ac400041b2969965178ee6eae62c92a11af33a0a883e4954e5fff98a0738a9f9aa2faf5b385d21974754e045aab31ae'
  19. '8036810e59fd436d0ddc8a1dea3b4dde6f76833f5413c72f280355e3595d3bb4bcce923e64619d8dfca3c8e95479795adad90e51526b22c0fa54c566aacac0ba'
  20. '46e1d119231176b043947669e2043dfcf550a23ad370d03ce0ebd0a46483f9d55d692a88020cf89840a1e6bf896a06a8f77a30877994473925b3cf4d74df0c4d'
  21. '7dfe51a456153e9fe6866584440efc92a5f983912de53a4197368ac515e705c8d7f2cb61d3f174cd5afc5b6f64060f112fc9a96e9760c4325daabe5e5b2f0257'
  22. 'd6098d35d4a29913827c7976bac86255637ef59dbb666fd8a282aeb1a2d45e33a60078aa95c65d5113047ae59ff61540ce1d0ca42185594a99cfdff3f0d3dd5b'
  23. 'c12cbc947d2bd853634c336f08cc3e2836661a549c5933bcdf1c244bc86ff34b7ec58eed43b20edc22a78726f3848da59d0512283466f10e5f714ee287f487c6')
  24. # see http://www.openldap.org/faq/data/cache/756.html
  25. # there's no proper backend support for anything apart from
  26. # BerkeleyDB, if we don't want to drop local backend server support
  27. # we are forced to keep Berkeley DB here
  28. prepare() {
  29. cd ${pkgbase}-${pkgver}
  30. if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
  31. # Debian patches
  32. export QUILT_PATCHES=debian/patches
  33. export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
  34. export QUILT_DIFF_ARGS='--no-timestamps'
  35. mv "$srcdir"/debian .
  36. # Doesn't apply and seems unimportant
  37. rm -v debian/patches/add-tlscacert-option-to-ldap-conf || true
  38. rm -v debian/patches/contrib-makefiles || true
  39. rm -v debian/patches/debian-version || true
  40. rm -v debian/patches/do-not-second-guess-sonames || true
  41. rm -v debian/patches/evolution-ntlm || true
  42. rm -v debian/patches/index-files-created-as-root || true
  43. rm -v debian/patches/lastbind-makefile-manpage || true
  44. rm -v debian/patches/ldap-conf-tls-cacertdir || true
  45. rm -v debian/patches/ldapi-socket-place || true
  46. rm -v debian/patches/slapi-errorlog-file || true
  47. rm -v debian/patches/man-slapd || true
  48. rm -v debian/patches/sasl-default-path || true
  49. rm -v debian/patches/set-maintainer-name || true
  50. rm -v debian/patches/smbk5pwd-makefile-manpage || true
  51. rm -v debian/patches/switch-to-lt_dlopenadvise-to-get-RTLD_GLOBAL-set.diff || true
  52. quilt push -av
  53. else
  54. patch -p1 -i "${srcdir}"/openldap-ntlm.patch
  55. fi
  56. sed -i 's|-m 644 $(LIBRARY)|-m 755 $(LIBRARY)|' libraries/{liblber,libldap,libldap_r}/Makefile.in
  57. sed -i 's|#define LDAPI_SOCK LDAP_RUNDIR LDAP_DIRSEP "run" LDAP_DIRSEP "ldapi"|#define LDAPI_SOCK LDAP_DIRSEP "run" LDAP_DIRSEP "openldap" LDAP_DIRSEP "ldapi"|' include/ldap_defaults.h
  58. sed -i 's|%LOCALSTATEDIR%/run|/run/openldap|' servers/slapd/slapd.{conf,ldif}
  59. sed -i 's|-$(MKDIR) $(DESTDIR)$(localstatedir)/run|-$(MKDIR) $(DESTDIR)/run/openldap|' servers/slapd/Makefile.in
  60. }
  61. build() {
  62. cd ${pkgbase}-${pkgver}
  63. autoconf
  64. ./configure --prefix=/usr \
  65. --sysconfdir=/etc --localstatedir=/var/lib/openldap \
  66. --enable-dynamic --enable-syslog --enable-ipv6 --enable-local \
  67. --enable-crypt --enable-spasswd --enable-modules \
  68. --enable-backends --disable-ndb --enable-overlays=mod \
  69. --with-cyrus-sasl --with-threads
  70. sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  71. make
  72. make -C contrib/slapd-modules/nssov OPT="$CFLAGS $CPPFLAGS" prefix=/usr sysconfdir=/etc/openldap
  73. make -C contrib/slapd-modules/autogroup OPT="$CFLAGS $CPPFLAGS" prefix=/usr sysconfdir=/etc/openldap
  74. make -C contrib/slapd-modules/lastbind OPT="$CFLAGS $CPPFLAGS" prefix=/usr sysconfdir=/etc/openldap
  75. make -C contrib/slapd-modules/passwd/sha2 OPT="$CFLAGS $CPPFLAGS" prefix=/usr sysconfdir=/etc/openldap
  76. }
  77. check() {
  78. cd ${pkgbase}-${pkgver}
  79. # make test
  80. }
  81. package_libldap() {
  82. pkgdesc="Lightweight Directory Access Protocol (LDAP) client libraries"
  83. depends=('libsasl' 'e2fsprogs')
  84. backup=('etc/openldap/ldap.conf')
  85. cd ${pkgbase}-${pkgver}
  86. for dir in include libraries doc/man/man3 ; do
  87. pushd ${dir}
  88. make DESTDIR="${pkgdir}" install
  89. popd
  90. done
  91. install -Dm644 doc/man/man5/ldap.conf.5.tmp "${pkgdir}"/usr/share/man/man5/ldap.conf.5
  92. # get rid of duplicate default conf files
  93. rm "${pkgdir}"/etc/openldap/*.default
  94. ln -sf liblber.so "${pkgdir}"/usr/lib/liblber.so.2
  95. ln -sf libldap.so "${pkgdir}"/usr/lib/libldap.so.2
  96. install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
  97. }
  98. package_openldap() {
  99. pkgdesc="Lightweight Directory Access Protocol (LDAP) client and server"
  100. depends=("libldap>=${pkgver}" 'libtool' 'unixodbc')
  101. backup=('etc/openldap/slapd.conf' 'etc/openldap/slapd.ldif' 'etc/sv/slapd/conf')
  102. install=openldap.install
  103. cd ${pkgbase}-${pkgver}
  104. for dir in clients servers doc/man/man{1,5,8}; do
  105. pushd ${dir}
  106. make DESTDIR="${pkgdir}" install
  107. popd
  108. done
  109. make -C contrib/slapd-modules/autogroup prefix=/usr sysconfdir=/etc/openldap DESTDIR="$pkgdir" install
  110. make -C contrib/slapd-modules/lastbind prefix=/usr sysconfdir=/etc/openldap DESTDIR="$pkgdir" install
  111. make -C contrib/slapd-modules/passwd/sha2 prefix=/usr sysconfdir=/etc/openldap DESTDIR="$pkgdir" install
  112. make -C contrib/slapd-modules/nssov prefix=/usr sysconfdir=/etc/openldap DESTDIR="$pkgdir" install
  113. install -m644 contrib/slapd-modules/nssov/slapo-nssov.5 "${pkgdir}"/usr/share/man/man5/slapo-nssov.5
  114. install -m644 contrib/slapd-modules/autogroup/slapo-autogroup.5 "${pkgdir}"/usr/share/man/man5/slapo-autogroup.5
  115. install -m644 contrib/slapd-modules/lastbind/slapo-lastbind.5 "${pkgdir}"/usr/share/man/man5/slapo-lastbind.5
  116. rm "${pkgdir}"/usr/share/man/man5/ldap.conf.5
  117. rm -r "${pkgdir}"/run
  118. # get rid of duplicate default conf files
  119. rm "${pkgdir}"/etc/openldap/*.default
  120. ln -s ../libexec/slapd "${pkgdir}"/usr/sbin/slapd
  121. chown root:439 "${pkgdir}"/etc/openldap/{slapd.{conf,ldif},DB_CONFIG.example}
  122. chmod 640 "${pkgdir}"/etc/openldap/{slapd.{conf,ldif},DB_CONFIG.example}
  123. install -dm700 -o 439 -g 439 "${pkgdir}"/var/lib/openldap
  124. chown -R 439:439 "${pkgdir}"/var/lib/openldap
  125. install -dm700 -o 439 -g 439 "${pkgdir}"/etc/openldap/slapd.d
  126. install -Dm755 "${srcdir}"/slapd.initd "${pkgdir}"/etc/init.d/slapd
  127. install -Dm644 "${srcdir}"/slapd.conf "${pkgdir}"/etc/sv/slapd/conf
  128. install -Dm755 "${srcdir}"/slapd.run "${pkgdir}"/etc/sv/slapd/run
  129. install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
  130. }