From: Arkadiusz Miƛkiewicz Date: Fri, 27 Sep 2013 08:22:56 +0000 (+0200) Subject: - initial from fc X-Git-Tag: auto/th/linenoise-0-0.git7946e2c~2 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=a2177096a7619600a9d28b775c469df5ffc14095;p=packages%2Flinenoise.git - initial from fc --- a2177096a7619600a9d28b775c469df5ffc14095 diff --git a/linenoise-build-shared-lib.patch b/linenoise-build-shared-lib.patch new file mode 100644 index 0000000..d5d9946 --- /dev/null +++ b/linenoise-build-shared-lib.patch @@ -0,0 +1,54 @@ +From 9eae71dcd60834f753264ddde13f37993f8b5556 Mon Sep 17 00:00:00 2001 +From: Dan Callaghan +Date: Mon, 7 Jan 2013 09:37:31 +1000 +Subject: [PATCH 1/2] build shared library + +--- + Makefile | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 3086e92..a1a906f 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,4 +1,19 @@ +-all: linenoise_example linenoise_utf8_example linenoise_cpp_example ++ ++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 linenoise_utf8_example linenoise_cpp_example ++ ++$(LIB): linenoise.o utf8.o ++ $(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) $(LDFLAGS) -o $@ $^ + + linenoise_example: linenoise.h linenoise.c example.c + $(CC) -Wall -W -Os -g -o $@ linenoise.c example.c +@@ -9,5 +24,15 @@ linenoise_utf8_example: linenoise.c utf8.c example.c + linenoise_cpp_example: linenoise.h linenoise.c + g++ -Wall -W -Os -g -o $@ linenoise.c example.c + ++.PHONY: clean + clean: +- rm -f linenoise_example linenoise_utf8_example linenoise_cpp_example *.o ++ rm -f $(LIB) linenoise_example linenoise_utf8_example linenoise_cpp_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 +-- +1.7.11.7 + diff --git a/linenoise-symbol-visibility.patch b/linenoise-symbol-visibility.patch new file mode 100644 index 0000000..19008c4 --- /dev/null +++ b/linenoise-symbol-visibility.patch @@ -0,0 +1,74 @@ +From 380255a37895b31b06602505c831e925bc8daa5d Mon Sep 17 00:00:00 2001 +From: Dan Callaghan +Date: Tue, 8 Jan 2013 21:22:31 +1000 +Subject: [PATCH 2/2] hide symbols for private utf8 utility functions + +--- + Makefile | 3 ++- + linenoise.h | 26 ++++++++++++++++---------- + 2 files changed, 18 insertions(+), 11 deletions(-) + +diff --git a/Makefile b/Makefile +index a1a906f..0a42a7f 100644 +--- a/Makefile ++++ b/Makefile +@@ -5,7 +5,8 @@ SONAME = liblinenoise.so.$(MAJOR_VERSION) + LIB = $(SONAME)$(EXTRA_VERSION) + + export CFLAGS ?= -Os -g +-CFLAGS += -Wall -fpic -DUSE_UTF8 ++CFLAGS += -Wall -fpic -DUSE_UTF8 \ ++ -fvisibility=hidden -DHAVE_VISIBILITY=1 -DBUILDING_LINENOISE=1 + LIBDIR ?= /usr/lib + INCLUDEDIR ?= /usr/include + +diff --git a/linenoise.h b/linenoise.h +index ab0058a..406aa3e 100644 +--- a/linenoise.h ++++ b/linenoise.h +@@ -37,6 +37,12 @@ + #ifndef __LINENOISE_H + #define __LINENOISE_H + ++#if BUILDING_LINENOISE && HAVE_VISIBILITY ++#define LINENOISE_EXPORTED __attribute__((__visibility__("default"))) ++#else ++#define LINENOISE_EXPORTED ++#endif ++ + #ifndef NO_COMPLETION + typedef struct linenoiseCompletions { + size_t len; +@@ -44,19 +50,19 @@ typedef struct linenoiseCompletions { + } linenoiseCompletions; + + typedef void(linenoiseCompletionCallback)(const char *, linenoiseCompletions *); +-void linenoiseSetCompletionCallback(linenoiseCompletionCallback *); +-void linenoiseAddCompletion(linenoiseCompletions *, const char *); ++LINENOISE_EXPORTED void linenoiseSetCompletionCallback(linenoiseCompletionCallback *); ++LINENOISE_EXPORTED void linenoiseAddCompletion(linenoiseCompletions *, const char *); + #endif + + typedef int(linenoiseCharacterCallback)(const char *, size_t, char); +-void linenoiseSetCharacterCallback(linenoiseCharacterCallback *, char); ++LINENOISE_EXPORTED void linenoiseSetCharacterCallback(linenoiseCharacterCallback *, char); + +-char *linenoise(const char *prompt); +-int linenoiseHistoryAdd(const char *line); +-int linenoiseHistorySetMaxLen(int len); +-int linenoiseHistorySave(const char *filename); +-int linenoiseHistoryLoad(const char *filename); +-void linenoiseHistoryFree(void); +-char **linenoiseHistory(int *len); ++LINENOISE_EXPORTED char *linenoise(const char *prompt); ++LINENOISE_EXPORTED int linenoiseHistoryAdd(const char *line); ++LINENOISE_EXPORTED int linenoiseHistorySetMaxLen(int len); ++LINENOISE_EXPORTED int linenoiseHistorySave(const char *filename); ++LINENOISE_EXPORTED int linenoiseHistoryLoad(const char *filename); ++LINENOISE_EXPORTED void linenoiseHistoryFree(void); ++LINENOISE_EXPORTED char **linenoiseHistory(int *len); + + #endif /* __LINENOISE_H */ +-- +1.7.11.7 + diff --git a/linenoise.spec b/linenoise.spec new file mode 100644 index 0000000..67b7ff0 --- /dev/null +++ b/linenoise.spec @@ -0,0 +1,77 @@ + +%global git_rev 7946e2c + +Summary: Minimal replacement for readline +Name: linenoise +Version: 0 +Release: 4.git%{git_rev}%{?dist} +# The licenses are a bit of a mess here... +# utf8.{c,h} contain incomplete license headers. They refer to a "LICENSE" file +# which is actually from jimtcl. A copy is committed in dist-git as +# jimtcl-LICENSE, retrieved from +# . I received a mail +# from the author, committed as steve-bennett-license-confirmation, confirming +# that that is indeed the LICENSE file referred to and therefore utf8.{c,h} are +# under a BSD-like license. +# linenoise.{c,h} contain complete BSD-like license headers so they are fine. +# And it means the whole library is definitely under a BSD-like license. +# But there is no separate license file shipped in the tarball. I queried Tad +# Marshall on 2013-01-10 to include one but never received a reply. So +# I synthesized one as Source1. +License: BSD +Group: Libraries +URL: https://github.com/tadmarshall/linenoise +Source0: https://github.com/tadmarshall/linenoise/tarball/%{git_rev}/%{name}-%{git_rev}.tar.gz +# Source0-md5: 7cb42d58db11bf3c33b8dd698ec92754 +Patch0: %{name}-build-shared-lib.patch +Patch1: %{name}-symbol-visibility.patch + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description +Linenoise is a replacement for the readline line-editing library with +the goal of being smaller. + +%description devel +This package contains files needed for developing software that uses +%{name}. + +%prep +%setup -q -n tadmarshall-%{name}-%{git_rev} +%patch0 -p1 +%patch1 -p1 + +%build +%{__make} \ + CC="%{__cc}" \ + LIBDIR="%{_libdir}" \ + INCLUDEDIR="%{_includedir}" \ + CFLAGS="%{rpmcflags}" + +%install +rm -rf $RPM_BUILD_ROOT + +%{__make} install \ + LIBDIR="%{_libdir}" \ + INCLUDEDIR="%{_includedir}" \ + CFLAGS="%{rpmcflags}" \ + DESTDIR="$RPM_BUILD_ROOT" + +%files +%defattr(644,root,root,755) +%doc README.markdown +%attr(755,root,root) %{_libdir}/liblinenoise.so.*.* +%attr(755,root,root) %ghost %{_libdir}/liblinenoise.so.0 + +%files devel +%defattr(644,root,root,755) +%{_includedir}/linenoise.h +%{_libdir}/liblinenoise.so + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%clean +rm -rf $RPM_BUILD_ROOT