aboutsummaryrefslogtreecommitdiffstats
path: root/main/heimdal/APKBUILD
blob: f40abb61bf20f299b6986a773565be1c6af5ace2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
pkgname=heimdal
pkgver=1.5.2
pkgrel=4
pkgdesc="An implementation of Kerberos 5"
arch="all"
url="http://www.h5l.org/"
license="BSD"
depends=
depends_dev="openssl-dev e2fsprogs-dev db-dev"
makedepends="$depends_dev autoconf automake bash gawk libtool
	ncurses-dev perl readline-dev sqlite-dev"
install=
subpackages="$pkgname-doc $pkgname-dev $pkgname-libs
	$pkgname-ftp $pkgname-telnet $pkgname-su $pkgname-rsh $pkgname-rcp
	$pkgname-pagsh $pkgname-kf"
source="http://ftp4.de.freesbie.org/pub/misc/heimdal/src/$pkgname-$pkgver.tar.gz
	003_all_heimdal-rxapps.patch
	005_all_heimdal-suid_fix.patch
	014_all_heimdal-path.patch
	telnetd.patch
	heimdal_missing-include.patch
	heimdal_missing_symbols.patch
	heimdal-1.5-use-perl-Getopt_Std.patch
	"

_builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	[ -e /usr/lib/libasn1.so ] && echo "## remove old heimdal pkg first ##" && return 1

	cd "$_builddir"
	
	for i in ../*.patch
	do
		msg "Applying patch $i"
		patch -p0 -i $i || return 1
	done

	# name clash with ruserpass in netdb.h
	sed -i -e 's/ruserpass/ruserpw/g' appl/ftp/ftp/*.[ch] || return 1

#	sed -i -e 's|var/heimdal|var/lib/heimdal|g' configure.in \
#	doc/setup.texi doc/heimdal.info kadmin/kadmind.8 kdc/kdc.8 \
#	lib/hdb/hdb.h lib/krb5/krb5.conf.5 lib/krb5/krb5.conf.cat5 || return 1

	sh ./autogen.sh || return 1
}

build() {
	cd "$_builddir"
	export LDFLAGS="${LDFLAGS} -Wl,--as-needed"
	export LIBS="-ldb"

	./configure --prefix=/usr \
		--enable-shared=yes \
		--without-x \
		--with-berkeley-db \
		--with-readline-lib=/usr/lib \
		--with-readline-include=/usr/include/readline \
		--with-sqlite3=/usr \
		--with-openssl=/usr || return 1

	# make sure we use system version
	rm -r lib/sqlite lib/com_err

	# workarount a parallell build issue
	make -C lib/asn1 der-protos.h der-private.h || return 1
	make -C lib/kadm5 kadm5_err.h || return 1
	make -C lib/krb5 krb5-protos.h krb5-private.h krb5_err.h krb_err.h \
		heim_err.h k524_err.h || return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" exec_prefix=/usr sysconfdir=/etc \
	mandir=/usr/share/man infodir=/usr/share/info datadir=/var/lib/heimdal \
	localstatedir=/var/lib/heimdal libexecdir=/usr/sbin install

	rm "$pkgdir"/usr/lib/*.la

	install -m644 -D krb5.conf ${pkgdir}/etc/krb5.conf || return 1
	install -m755 -D ../../heimdal-kadmind.init ${pkgdir}/etc/init.d/heimdal-kadmind
	install -m755 -D ../../heimdal-kdc.init ${pkgdir}/etc/init.d/heimdal-kdc
	install -m755 -D ../../heimdal-kpasswdd.init ${pkgdir}/etc/init.d/heimdal-kpasswdd

	# Remove editline, we use libreadline
	#rm ${pkgdir}/usr/lib/libeditline.* || return 1
	#rm ${pkgdir}/usr/include/editline.h || return 1
	#rm ${pkgdir}/usr/share/man/man3/editline.* || return 1

	# Rename daemons and their manpages
	for i in telnetd ftpd rshd; do
		mv ${pkgdir}/usr/share/man/man8/${i}.8 ${pkgdir}/usr/share/man/man8/k${i}.8 || return 1
		mv ${pkgdir}/usr/sbin/${i} ${pkgdir}/usr/sbin/k${i} || return 1
	done

	# Rename clients and their manpages
	for i in rcp rsh telnet ftp su login; do
		if [ -f ${pkgdir}/usr/share/man/man1/${i}.1 ]; then
			mv ${pkgdir}/usr/share/man/man1/${i}.1 ${pkgdir}/usr/share/man/man1/k${i}.1 || return 1
		fi
		mv ${pkgdir}/usr/bin/${i} ${pkgdir}/usr/bin/k${i} || return 1
	done
	for i in 1 3 5 8; do
		rm -rf "$pkgdir"/usr/share/man/cat$i
	done

	# Remove conflicts 
	# e2fsprogs
	rm -f "$pkgdir"/usr/bin/compile_et \
		"$pkgdir"/usr/share/man/man1/compile_et.1
	# man-page
	rm "$pkgdir"/usr/share/man/man5/ftpusers.5*
	# openssl
	rm "$pkgdir"/usr/share/man/man3/DES*
	rm "$pkgdir"/usr/share/man/man3/DH*
	rm "$pkgdir"/usr/share/man/man3/EVP*
	rm "$pkgdir"/usr/share/man/man3/OpenSSL*
	rm "$pkgdir"/usr/share/man/man3/RAND*
	rm "$pkgdir"/usr/share/man/man3/RSA*
	# erlang
  	rm "$pkgdir"/usr/share/man/man3/os.3*

	# Compress info pages
	for page in heimdal hx509; do
		gzip -9 "$pkgdir"/usr/share/info/${page}.info
	done

	# Install the license
	install -d "$pkgdir"/usr/share/licenses/$pkgname
	install -D -m644 "$srcdir"/$pkgname-$pkgver/LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/ || return 1
}

libs() {
	pkgdesc="Heimdal libraries"
	replaces="heimdal"
	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/sbin
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1
	mv "$pkgdir"/usr/bin/string2key \
		"$pkgdir"/usr/bin/verify_krb5_conf \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/sbin/kdigest \
		"$pkgdir"/usr/sbin/digest-service \
		"$subpkgdir"/usr/sbin/ || return 1

}

ftp() {
	mkdir -p $subpkgdir/usr/bin/
	mv $pkgdir/usr/bin/kftp $subpkgdir/usr/bin/kftp
	mkdir -p $subpkgdir/usr/sbin/
	mv $pkgdir/usr/sbin/kftpd $subpkgdir/usr/sbin/kftpd
}

telnet() {
	mkdir -p $subpkgdir/usr/bin/
	mv $pkgdir/usr/bin/ktelnet $subpkgdir/usr/bin/ktelnet
	mkdir -p $subpkgdir/usr/sbin/
	mv $pkgdir/usr/sbin/ktelnetd $subpkgdir/usr/sbin/ktelnetd
}

su() {
	mkdir -p $subpkgdir/usr/bin/
	mv $pkgdir/usr/bin/ksu $subpkgdir/usr/bin/ksu
}

rsh() {
	mkdir -p $subpkgdir/usr/bin/
	mv $pkgdir/usr/bin/krsh $subpkgdir/usr/bin/krsh
	mkdir -p $subpkgdir/usr/sbin/
	mv $pkgdir/usr/sbin/krshd $subpkgdir/usr/sbin/krshd
}

rcp() {
        mkdir -p $subpkgdir/usr/bin/
	mv $pkgdir/usr/bin/krcp $subpkgdir/usr/bin/krcp
}

pagsh() {
        mkdir -p $subpkgdir/usr/bin/
        mv $pkgdir/usr/bin/pagsh $subpkgdir/usr/bin/pagsh
}

kf() {
        mkdir -p $subpkgdir/usr/bin/
        mv $pkgdir/usr/bin/kf $subpkgdir/usr/bin/kf
}

md5sums="bb23d9dbdafd395d816f7abc598481a1  heimdal-1.5.2.tar.gz
2feec3924ee5230b54175b4d4000c872  003_all_heimdal-rxapps.patch
45aeb207f360f9f4e9e0fabc8bfeecbc  005_all_heimdal-suid_fix.patch
8208ae8c0b6ff5ab4f64af1693e9e396  014_all_heimdal-path.patch
f320b91692b872e28f446f9cf1bc68bf  telnetd.patch
8e127440fe11380c65fda40283326a46  heimdal_missing-include.patch
a14b9001271c3b794b083c25936ebe21  heimdal_missing_symbols.patch
dbe4106d1ca938587c948ee34121c020  heimdal-1.5-use-perl-Getopt_Std.patch"