aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testing/linenoise/APKBUILD46
-rw-r--r--testing/linenoise/build-shared-lib.patch37
2 files changed, 83 insertions, 0 deletions
diff --git a/testing/linenoise/APKBUILD b/testing/linenoise/APKBUILD
new file mode 100644
index 0000000000..2f34defb68
--- /dev/null
+++ b/testing/linenoise/APKBUILD
@@ -0,0 +1,46 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer:
+pkgname=linenoise
+pkgver=1.0
+pkgrel=0
+pkgdesc="Minimal replacement for readline"
+url="https://github.com/antirez/linenoise"
+arch="all"
+license="BSD"
+depends=""
+depends_dev=""
+makedepends="$depends_dev"
+install=""
+subpackages="$pkgname-dev"
+source="linenoise-$pkgver.tar.gz::https://github.com/antirez/linenoise/archive/$pkgver.tar.gz
+ build-shared-lib.patch
+ "
+
+_builddir="$srcdir"/linenoise-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+ rm -f "$pkgdir"/usr/lib/*.la
+}
+
+md5sums="57c163f6e53bdb5b8f935cafb714ab16 linenoise-1.0.tar.gz
+ad5599c58cb711f34058f0c8d913ebf6 build-shared-lib.patch"
+sha256sums="f5054a4fe120d43d85427cf58af93e56b9bb80389d507a9bec9b75531a340014 linenoise-1.0.tar.gz
+71d2c1678580a8551b7c8c81d8026855c9cec654401355aec9a3ae591ff2aab1 build-shared-lib.patch"
+sha512sums="9e68fade8d64d7ba8d5d681e74d0ca6c4ebd9576249bb0e885b1aa708a9af77a43ea6264307ae46fb74e52219387a2c831b570f9601e331837f35294af9883e3 linenoise-1.0.tar.gz
+e37fe58f414f48a6a6fcab9925881131d2dbca0c54fe2b17a359d0b5c58ce1e29dad92baa8dc7f7d390af1edace2a75091f20bed5aa381ff2599e734616b2418 build-shared-lib.patch"
diff --git a/testing/linenoise/build-shared-lib.patch b/testing/linenoise/build-shared-lib.patch
new file mode 100644
index 0000000000..2f9542dcfd
--- /dev/null
+++ b/testing/linenoise/build-shared-lib.patch
@@ -0,0 +1,37 @@
+--- ./Makefile.orig
++++ ./Makefile
+@@ -1,7 +1,33 @@
++MAJOR_VERSION = 0
++EXTRA_VERSION = .0.0
++SONAME = liblinenoise.so.$(MAJOR_VERSION)
++LIB = $(SONAME)$(EXTRA_VERSION)
++
++export CFLAGS ?= -Os -g
++CFLAGS += -Wall -fpic -DUSE_UTF8
++LIBDIR ?= /usr/lib
++INCLUDEDIR ?= /usr/include
++
++.PHONY: all
++all: $(LIB) linenoise_example
++
++$(LIB): linenoise.o
++ $(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) $(LDFLAGS) -o $@ $^
++
+ linenoise_example: linenoise.h linenoise.c
+
+ linenoise_example: linenoise.c example.c
+ $(CC) -Wall -W -Os -g -o linenoise_example linenoise.c example.c
+
++.PHONY: clean
+ clean:
+- rm -f linenoise_example
++ rm -f$(LIB) linenoise_example *.o
++
++.PHONY: install
++install: $(LIB)
++ install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)
++ install -m 0644 linenoise.h $(DESTDIR)$(INCLUDEDIR)
++ install -m 0755 -d $(DESTDIR)$(LIBDIR)
++ install -m 0755 $(LIB) $(DESTDIR)$(LIBDIR)
++ ldconfig -n $(DESTDIR)$(LIBDIR)
++ ln -s $(LIB) $(DESTDIR)$(LIBDIR)/liblinenoise.so