Magellan Linux

Contents of /smage/trunk/extras/openldap/openldap-2.4.52-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15459 - (show annotations) (download)
Thu Sep 3 14:04:53 2020 UTC (3 years, 7 months ago) by niro
File size: 4534 byte(s)
auto added: ver bump to 2.4.52-r2
1 # $Id$
2
3 PNAME="openldap"
4 PVER="2.4.52"
5 PBUILD="r2"
6
7 SPLIT_PACKAGES="libldap libldap-dev openldap"
8
9 PCAT="net-nds"
10 HOMEPAGE="http://www.openldap.org/"
11
12 # enable features or not (0|1)
13 ENABLE_SASL=0
14 ENABLE_TCPWRAPPERS=0
15
16 LIB_DEPEND=">= dev-libs/openssl-1.1"
17
18 if [[ ${ENABLE_SASL} = 1 ]]
19 then
20 LIB_DEPEND="${LIB_DEPEND}
21 >= dev-libs/cyrus-sasl-2.1.26"
22 fi
23 if [[ ${ENABLE_TCPWRAPPERS} = 1 ]]
24 then
25 LIB_DEPEND="${LIB_DEPEND}
26 >= sys-apps/tcp-wrappers-7"
27 fi
28
29 # requires libltdl.so.7 from libtool package
30 LDAP_DEPEND=">= dev-db/db-6.2
31 >= sys-libs/libuuid-2.34
32 >= sys-libs/libltdl-2.4"
33
34 ALX_DEV_DEPEND=">= dev-db/db-dev-6.2
35 >= sys-libs/libuuid-dev-2.34
36 >= dev-libs/openssl-dev-1.1"
37
38 SDEPEND="${LIB_DEPEND}
39 ${LDAP_DEPEND}
40 >= sys-apps/util-linux-2.34
41 >= sys-dev/libtool-2.4
42 ${ALX_DEV_DEPEND}"
43
44 SRCFILE="${PNAME}-${PVER}.tgz"
45 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
46
47 sminclude multilib mtools systemd rpath
48 msetfeature "!check"
49
50 SRC_URI=(
51 http://www.openldap.org/software/download/OpenLDAP/openldap-release/${SRCFILE}
52 mirror://${PNAME}/${SRCFILE}
53 mirror://${PNAME}/slapd.service
54 mirror://${PNAME}/slapd.confd
55 mirror://${PNAME}/slapd.tmpfile
56 )
57
58 UP2DATE="updatecmd http://www.openldap.org/software/download/ | grep 'currently avail' | sed 's/.*OpenLDAP-\(.*\)\ is.*/\1/'"
59
60 split_info_libldap()
61 {
62 DESCRIPTION="Lightweight Directory Access Protocol client libraries."
63 DEPEND="${LIB_DEPEND}"
64 }
65
66 split_info_openldap()
67 {
68 DESCRIPTION="OpenLDAP is an open source implementation of the Lightweight Directory Access Protocol."
69 DEPEND="== net-nds/libldap-${PVER}
70 ${LDAP_DEPEND}"
71 }
72
73 pkg_setup()
74 {
75 preinstall_openldap
76 }
77
78 src_prepare()
79 {
80 munpack ${SRCFILE} || die
81
82 local abi
83 for abi in ${MULTILIB_ABIS}
84 do
85 cd ${SRCDIR}-${abi}
86 # fix localstate dir to /run/openldap
87 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 || die
88 sed -i 's:%LOCALSTATEDIR%/run:/run/openldap:' servers/slapd/slapd.conf || die
89 sed -i 's:-$(MKDIR) $(DESTDIR)$(localstatedir)/run:-$(MKDIR) $(DESTDIR)/run/openldap:' servers/slapd/Makefile.in || die
90
91 # remove db version limits
92 sed -i '/6.0.20/ a\\t__db_version_compat' build/openldap.m4 || die
93
94 # non standard, autoreconf doesn't work
95 libtoolize --force || die
96 aclocal || die
97 autoconf --force || die
98 done
99 }
100
101 src_compile()
102 {
103 local myconf
104
105 if [[ ${ENABLE_SASL} = 1 ]]
106 then
107 # enable sasl
108 myconf+=" --with-cyrus-sasl"
109 else
110 # disable sasl
111 myconf+=" --without-cyrus-sasl"
112 fi
113
114 if [[ ${ENABLE_TCPWRAPPERS} = 1 ]]
115 then
116 # enable tcp-wrappers
117 myconf+=" --enable-wrappers"
118 else
119 # disable tcp-wrappers
120 myconf+=" --disable-wrappers"
121 fi
122
123 # use mdb as default db, drop berkeley db support
124 mconfigure \
125 --localstatedir=/var/lib/openldap \
126 --libexecdir=/usr/$(mlibdir)/openldap \
127 --enable-overlays=mod \
128 --enable-modules=yes \
129 ${myconf} \
130 || die
131
132 mmake || die
133 }
134
135 src_install_libldap()
136 {
137 mmake -j1 -C libraries DESTDIR=${BINDIR} install || die
138 }
139
140 src_install_libldap-dev()
141 {
142 mmake -j1 -C include DESTDIR=${BINDIR} install || die
143 mmake -j1 -C doc/man/man3 DESTDIR=${BINDIR} install || die
144 # install ldap.conf man
145 cp doc/man/man5/ldap.conf.5.tmp ldap.conf.5 || die
146 minstallman ldap.conf.5 || die
147
148 minstalldocs COPYRIGHT LICENSE || die
149 }
150
151 src_install_openldap()
152 {
153 mmake -j1 -C clients DESTDIR=${BINDIR} install || die
154 mmake -j1 -C servers DESTDIR=${BINDIR} install || die
155 mmake -j1 -C doc/man/man1 DESTDIR=${BINDIR} install || die
156 mmake -j1 -C doc/man/man5 DESTDIR=${BINDIR} install || die
157 mmake -j1 -C doc/man/man8 DESTDIR=${BINDIR} install || die
158 # missing symlink
159 mlink ../$(mlibdir)/openldap/slapd /usr/sbin/slapd || die
160 # remove ldap.conf man, which is in the lib package
161 mdelete /usr/share/man/man5/ldap.conf.5 || die
162
163 # create runtime
164 mkeepdir /var/lib/openldap || die
165 mchown ldap:ldap /var/lib/openldap || die
166 mchmod 0700 /var/lib/openldap || die
167 # openldap modules dir
168 mkeepdir /usr/$(mlibdir)/openldap/openldap || die
169
170 # service
171 minstallunit slapd.service || die
172 minstallconf slapd.confd slapd || die
173 minstalltmp slapd.tmpfile slapd.conf || die
174
175 # remove insecure rpath
176 mdeleterpath || die
177
178 minstalldocs ANNOUNCEMENT CHANGES COPYRIGHT LICENSE || die
179 }
180
181 preinstall_openldap()
182 {
183 # adding ldap user
184 mgroupadd -o "-g 439" ldap
185 museradd -o "-u 439 -g ldap -d /var/lib/openldap -s /bin/false" ldap
186 }
187
188 postinstall_openldap()
189 {
190 mstartunit slapd.service
191 }
192
193 postremove_openldap()
194 {
195 mstopunit slapd.service
196 }