Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/fts: change package source [and implementation]

From: Jonathan Curran <jonathan_at_curran.in>
Date: Wed, 9 Sep 2015 02:07:11 +0000

Updated the source to use musl-fts that is used in voidlinux. It's
up-to-date based on fts in NetBSD and includes headers that produce no
warnings when compiled against. I've tested it against existing
dependences (libcgroup) and it appears to be fine.

https://github.com/pullmoll/musl-fts
---
 testing/fts/00-static-and-shared-libs.patch | 49 ++++++++++++++++++++++
 testing/fts/APKBUILD                        | 65 ++++++++++-------------------
 testing/fts/fts-header-correctness.patch    | 20 ---------
 testing/fts/fts-uclibc.patch                | 45 --------------------
 testing/fts/stdint.patch                    | 10 -----
 5 files changed, 72 insertions(+), 117 deletions(-)
 create mode 100644 testing/fts/00-static-and-shared-libs.patch
 delete mode 100644 testing/fts/fts-header-correctness.patch
 delete mode 100644 testing/fts/fts-uclibc.patch
 delete mode 100644 testing/fts/stdint.patch
diff --git a/testing/fts/00-static-and-shared-libs.patch b/testing/fts/00-static-and-shared-libs.patch
new file mode 100644
index 0000000..b65b1d0
--- /dev/null
+++ b/testing/fts/00-static-and-shared-libs.patch
_at_@ -0,0 +1,49 @@
+diff --git a/.gitignore b/.gitignore
+index 528fe32..663e6bb 100644
+--- a/.gitignore
++++ b/.gitignore
+_at_@ -10,4 +10,5 @@ config.status
+ configure
+ depcomp
+ install-sh
++ltmain.sh
+ missing
+diff --git a/Makefile.am b/Makefile.am
+index aa93562..f09994e 100644
+--- a/Makefile.am
++++ b/Makefile.am
+_at_@ -1,5 +1,5 @@
+ ## Makefile.am - procress this file with automake to produce Makefile.in
+-lib_LIBRARIES = libfts.a
+-libfts_a_SOURCES = fts.c
+-libfts_a_HEADERS = fts.h
+-libfts_adir = $(includedir)
++lib_LTLIBRARIES = libfts.la
++libfts_la_SOURCES = fts.c
++libfts_la_HEADERS = fts.h
++libfts_ladir = $(includedir)
+diff --git a/bootstrap.sh b/bootstrap.sh
+index 9e026b5..cd4a585 100755
+--- a/bootstrap.sh
++++ b/bootstrap.sh
+_at_@ -1,4 +1,5 @@
+ #!/bin/sh
++libtoolize
+ aclocal
+ autoconf
+ automake --add-missing
+diff --git a/configure.ac b/configure.ac
+index 28dd6c6..6f12859 100644
+--- a/configure.ac
++++ b/configure.ac
+_at_@ -7,7 +7,9 @@ AC_INIT([fts], [1.1], [Jürgen Buchmüller <pullmoll_at_t-online.de>])
+ AM_INIT_AUTOMAKE([1.15])
+ 
+ AC_PROG_CC
+-AC_PROG_RANLIB
++AC_PROG_LIBTOOL
++
++LT_INIT
+ 
+ AC_CHECK_HEADERS(assert.h dirent.h errno.h fcntl.h stdlib.h string.h unistd.h sys/param.h sys/stat.h)
+ 
diff --git a/testing/fts/APKBUILD b/testing/fts/APKBUILD
index c132482..8677a6b 100644
--- a/testing/fts/APKBUILD
+++ b/testing/fts/APKBUILD
_at_@ -1,28 +1,24 @@
 # Contributor: William Pitcock <nenolod_at_dereferenced.org>
 # Maintainer: William Pitcock <nenolod_at_dereferenced.org>
 pkgname=fts
-pkgver=0
-pkgrel=4
-pkgdesc="keith bostic's POSIX file tree stream operations library"
-url="http://bostic.com/"
+pkgver=1.1
+pkgrel=5
+pkgdesc="Provides the fts(3) functions, which are missing in musl libc"
+url="https://github.com/pullmoll/musl-fts/"
 arch="all"
 license="BSD"
 depends=
-depends_dev=
-makedepends="$depends_dev bsd-compat-headers"
+depends_dev="autoconf automake"
+makedepends="$depends_dev"
 install=""
-subpackages="$pkgname-dev $pkgname-doc"
-replaces_doc="man-pages"
-source="saveas-https://sites.google.com/a/bostic.com/keithbostic/files/fts.tar.gz?attredirects=0/fts.tar.gz
-	fts-uclibc.patch
-	fts-header-correctness.patch
-	stdint.patch"
+subpackages="$pkgname-dev"
+source="https://github.com/pullmoll/musl-fts/archive/v1.1.zip
+	00-static-and-shared-libs.patch"
 
-_builddir="${srcdir}/${pkgname}"
+_builddir="${srcdir}/musl-${pkgname}-${pkgver}"
 prepare() {
 	local i
 	cd "$_builddir"
-	chmod +w *.c
 	for i in $source; do
 		case $i in
 		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
_at_@ -32,39 +28,24 @@ prepare() {
 
 build() {
 	cd "$_builddir"
-	gcc -I. -fPIC -shared -o libfts.so -Wl,-soname,libfts.so.${pkgver} fts.c
+	./bootstrap.sh
+	./configure --build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr || return 1
+	make || return 1
 }
 
 package() {
 	cd "$_builddir"
-
-	install -d "$pkgdir"/usr/lib
-
-	install -m 755 libfts.so "$pkgdir"/usr/lib/libfts.so.${pkgver}
-	ln -sf libfts.so.${pkgver} "$pkgdir"/usr/lib/libfts.so
-
-	install -d "$pkgdir"/usr/include
-	install -m 644 fts.h "$pkgdir"/usr/include/fts.h
-
-	install -d "$pkgdir"/usr/share/man/man3
-	install -m 644 fts.3 "$pkgdir"/usr/share/man/man3/fts.3
+	make DESTDIR=${pkgdir} install || return 1
 
 	mkdir -p "$pkgdir"/usr/lib/pkgconfig
-	cat >"$pkgdir"/usr/lib/pkgconfig/libfts.pc <<__EOF__
-prefix=/usr
-exec_prefix=\${prefix}
-libdir=\${exec_prefix}/lib
-includedir=\${exec_prefix}/include
-
-Name: libfts
-Description: $pkgdesc
-Version: $pkgver
-Libs: -lfts
-Cflags: 
-__EOF__
+	cp "$_builddir"/musl-fts.pc "$pkgdir"/usr/lib/pkgconfig/libfts.pc
 }
 
-md5sums="120c14715485ec6ced14f494d059d20a  fts.tar.gz
-588fead4044bf535ff97298651aaab8f  fts-uclibc.patch
-b197744ece4ef9a5fa52692acf9b6666  fts-header-correctness.patch
-a8a5a8e81e1c67738aef00f3f13a718b  stdint.patch"
+md5sums="9ee52bbf56df87d3cf5349407d26ab01  v1.1.zip
+db14405fba57173dc1f72bae322bcddb  00-static-and-shared-libs.patch"
+sha256sums="17154766ca2c1e2e7ca55039a4a10a0334427fe986cd52b8c936667e80350954  v1.1.zip
+aea0dde6690df477b4575362c9101981835abbf2bf04cf1a02911917efc23695  00-static-and-shared-libs.patch"
+sha512sums="e2e03589d31a0494c1652fa411260646497c623598569443fd18718f63013c871bebef1765ebe6129895f5fd6008c0bf6d2a0d843ac2645eb6d9615056f6ba7e  v1.1.zip
+dc455af94a97524024ae714ae57ca123a6732e3d9872a56d1cf282107cba09e30efd976b9c448c0c520407b1e43c71e36deec3e0655dcf3076d293ac7af8a9ac  00-static-and-shared-libs.patch"
diff --git a/testing/fts/fts-header-correctness.patch b/testing/fts/fts-header-correctness.patch
deleted file mode 100644
index 59061bf..0000000
--- a/testing/fts/fts-header-correctness.patch
+++ /dev/null
_at_@ -1,20 +0,0 @@
---- fts.orig/fts.h
-+++ fts/fts.h
-_at_@ -38,6 +38,17 @@
- #ifndef	_FTS_H_
- #define	_FTS_H_
- 
-+#include <sys/types.h>
-+#include <sys/param.h>
-+#include <sys/stat.h>
-+
-+#include <dirent.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <unistd.h>
-+
- typedef struct {
- 	struct _ftsent *fts_cur;	/* current node */
- 	struct _ftsent *fts_child;	/* linked list of children */
diff --git a/testing/fts/fts-uclibc.patch b/testing/fts/fts-uclibc.patch
deleted file mode 100644
index 3593530..0000000
--- a/testing/fts/fts-uclibc.patch
+++ /dev/null
_at_@ -1,45 +0,0 @@
---- fts.orig/fts.c
-+++ fts/fts.c
-_at_@ -31,6 +31,10 @@
-  * SUCH DAMAGE.
-  */
- 
-+#define	alignof(TYPE)   ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2)
-+#define	ALIGNBYTES	(alignof(long double) - 1)
-+#define	ALIGN(p)	(((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES) 
-+
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "_at_(#)fts.c	8.6 (Berkeley) 8/14/94";
- #endif /* LIBC_SCCS and not lint */
-_at_@ -652,10 +656,10 @@
- 		if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
- 			continue;
- 
--		if ((p = fts_alloc(sp, dp->d_name, (int)dp->d_namlen)) == NULL)
-+		if ((p = fts_alloc(sp, dp->d_name, (int)dp->d_reclen)) == NULL)
- 			goto mem1;
--		if (dp->d_namlen > maxlen) {
--			if (fts_palloc(sp, (size_t)dp->d_namlen)) {
-+		if (dp->d_reclen > maxlen) {
-+			if (fts_palloc(sp, (size_t)dp->d_reclen)) {
- 				/*
- 				 * No more memory for path or structures.  Save
- 				 * errno, free up the current structure and the
-_at_@ -675,7 +679,7 @@
- 			maxlen = sp->fts_pathlen - sp->fts_cur->fts_pathlen - 1;
- 		}
- 
--		p->fts_pathlen = len + dp->d_namlen + 1;
-+		p->fts_pathlen = len + dp->d_reclen + 1;
- 		p->fts_parent = sp->fts_cur;
- 		p->fts_level = level;
- 
-_at_@ -784,7 +788,7 @@
- 	/* If user needs stat info, stat buffer already allocated. */
- 	sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
- 
--#ifdef DT_WHT
-+#ifdef S_IFWHT
- 	/*
- 	 * Whited-out files don't really exist.  However, there's stat(2) file
- 	 * mask for them, so we set it so that programs (i.e., find) don't have
diff --git a/testing/fts/stdint.patch b/testing/fts/stdint.patch
deleted file mode 100644
index 1ad7157..0000000
--- a/testing/fts/stdint.patch
+++ /dev/null
_at_@ -1,10 +0,0 @@
---- ./fts.c.orig
-+++ ./fts.c
-_at_@ -46,6 +46,7 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <fts.h>
-+#include <stdint.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
-- 
2.4.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Sep 09 2015 - 02:07:11 GMT