summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Bogusz2012-11-11 15:46:46 (GMT)
committerJakub Bogusz2012-11-11 15:46:46 (GMT)
commit02dba676b276a1971e4d3438c89c7ab681a86036 (patch)
tree7296e930a7e70ebbf19103a73d0e7d452dddfcfe
downloadslibc-master.zip
slibc-master.tar.gz
-rw-r--r--slibc-glibc.patch27
-rw-r--r--slibc-make.patch47
-rw-r--r--slibc.spec133
3 files changed, 207 insertions, 0 deletions
diff --git a/slibc-glibc.patch b/slibc-glibc.patch
new file mode 100644
index 0000000..11cc831
--- /dev/null
+++ b/slibc-glibc.patch
@@ -0,0 +1,27 @@
+--- slibc-0.9.2/src/gnu_vfscanf_s.c.orig 2012-11-10 15:37:49.760311665 +0100
++++ slibc-0.9.2/src/gnu_vfscanf_s.c 2012-11-10 15:37:35.436978932 +0100
+@@ -17,6 +17,10 @@
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
++/* defines needed by libc-lock.h, but removed in glibc 2.16 */
++# define PTFAVAIL(NAME) (NAME != NULL)
++# define __libc_ptf_call_always(FUNC, ARGS) FUNC ARGS
++
+ #include <assert.h>
+ #include <errno.h>
+ #include <limits.h>
+@@ -28,7 +32,13 @@
+ #include <string.h>
+ #include <wchar.h>
+ #include <wctype.h>
++#ifdef __cplusplus
++extern "C" {
++#endif
+ #include <bits/libc-lock.h>
++#ifdef __cplusplus
++}
++#endif
+ #include <locale.h>
+ #include <stddef.h>
+ #include "slibc.h"
diff --git a/slibc-make.patch b/slibc-make.patch
new file mode 100644
index 0000000..1f03cac
--- /dev/null
+++ b/slibc-make.patch
@@ -0,0 +1,47 @@
+--- slibc-0.9.2/Makefile.orig 2012-10-31 13:47:17.000000000 +0100
++++ slibc-0.9.2/Makefile 2012-11-10 22:13:43.459314816 +0100
+@@ -13,14 +13,14 @@
+ cd ./gen/ && tar czf $(ARCHIVE_NAME).tar.gz $(ARCHIVE_NAME)/
+ rm -rf ./gen/$(ARCHIVE_NAME)
+
+-install_devel: test
++install_devel:
+ mkdir -p $(DESTDIR)$(libdir)/
+ cp src/$(SLIBC_LIB) $(DESTDIR)$(libdir)/$(SLIBC_LIB)
+ cp src/$(SLIBC_LIB_CPP) $(DESTDIR)$(libdir)/$(SLIBC_LIB_CPP)
+ mkdir -p $(DESTDIR)/usr/include/slibc/
+ cp -r include/slibc/* $(DESTDIR)/usr/include/slibc/
+
+-install: test
++install:
+ mkdir -p $(DESTDIR)$(libdir)/
+ cp src/$(SLIBC_LIB_SH) $(DESTDIR)$(libdir)/$(SLIBC_LIB_SH)
+ cp src/$(SLIBC_LIB_CPP_SH) $(DESTDIR)$(libdir)/$(SLIBC_LIB_CPP_SH)
+--- slibc-0.9.2/src/Makefile.orig 2012-10-31 13:29:06.000000000 +0100
++++ slibc-0.9.2/src/Makefile 2012-11-11 12:53:08.580433809 +0100
+@@ -17,20 +17,20 @@
+ gnu_qsort_s_cpp.o gnu_bsearch_s_cpp.o gnu_strtok_s_cpp.o gnu_vfscanf_s_cpp.o
+
+ # static libraries
+-# $(SLIBC_LIB): $(SLIBC_OBJS)
+-# ar rcs $(SLIBC_LIB) $(SLIBC_OBJS)
++$(SLIBC_LIB): $(SLIBC_OBJS)
++ ar rcs $(SLIBC_LIB) $(SLIBC_OBJS)
+
+-# $(SLIBC_LIB_CPP): $(SLIBC_OBJS_CPP)
+-# ar rcs $(SLIBC_LIB_CPP) $(SLIBC_OBJS_CPP)
++$(SLIBC_LIB_CPP): $(SLIBC_OBJS_CPP)
++ ar rcs $(SLIBC_LIB_CPP) $(SLIBC_OBJS_CPP)
+
+ $(SLIBC_LIB_SO): $(SLIBC_OBJS)
+- $(CC) -shared -shared -Wl,-soname,$(SLIBC_LIB_SONAME) -o $(SLIBC_LIB_SO) $(SLIBC_OBJS)
++ $(CC) -shared -Wl,-soname,$(SLIBC_LIB_SONAME) -o $(SLIBC_LIB_SO) $(SLIBC_OBJS) -pthread
+ ln -s -f $(SLIBC_LIB_SO) $(SLIBC_LIB_SONAME)
+ ln -s -f $(SLIBC_LIB_SONAME) lib$(SLIBC_NAME).so
+
+ $(SLIBC_LIB_CPP_SO): $(SLIBC_OBJS_CPP)
+- $(CXX) -shared -shared -Wl,-soname,$(SLIBC_LIB_CPP_SONAME) -o $(SLIBC_LIB_CPP_SO) $(SLIBC_OBJS_CPP)
++ $(CXX) -shared -shared -Wl,-soname,$(SLIBC_LIB_CPP_SONAME) -o $(SLIBC_LIB_CPP_SO) $(SLIBC_OBJS_CPP) -pthread
+ ln -s -f $(SLIBC_LIB_CPP_SO) $(SLIBC_LIB_CPP_SONAME)
+ ln -s -f $(SLIBC_LIB_CPP_SONAME) lib$(SLIBC_NAME_CPP).so
+
diff --git a/slibc.spec b/slibc.spec
new file mode 100644
index 0000000..0ec486f
--- /dev/null
+++ b/slibc.spec
@@ -0,0 +1,133 @@
+#
+# Conditional build:
+%bcond_with apidocs # build and package API docs [nothing useful as of 0.9.2]
+%bcond_without static_libs # don't build static libraries
+%bcond_without tests # don't perform "make test"
+#
+Summary: Implementation of the bounds-checking C functions
+Summary(pl.UTF-8): Implementacja funkcji C z kontrolą ograniczeń
+Name: slibc
+Version: 0.9.2
+Release: 1
+License: LGPL v2.1+
+Group: Libraries
+#Source0Download: http://code.google.com/p/slibc/downloads/list
+Source0: http://slibc.googlecode.com/files/%{name}-%{version}.tar.gz
+# Source0-md5: 9400e134e714b1fb94234075e628e1b9
+Patch0: %{name}-glibc.patch
+Patch1: %{name}-make.patch
+URL: http://code.google.com/p/slibc/
+BuildRequires: libstdc++-devel
+%{?with_apidocs:BuildRequires: doxygen}
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This library provides an implementation of the bounds-checking C
+functions (as specified in Annex K of the current C standard, a.k.a.
+C11) for use with the GNU C library.
+
+%description -l pl.UTF-8
+Ta biblioteka udostępnia implementacje funkcji C z kontrolą ograniczeń
+(zgodnych z Annex K obecnego standardu C, tj. C11), przeznaczone do
+używania z bibloteką GNU C.
+
+%package devel
+Summary: Header files for slibc library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki slibc
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Header files for slibc library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki slibc.
+
+%package static
+Summary: Static slibc library
+Summary(pl.UTF-8): Statyczna biblioteka slibc
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+Static slibc library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka slibc.
+
+%package apidocs
+Summary: %{name} API documentation
+Summary(pl.UTF-8): Dokumentacja API biblioteki %{name}
+Group: Documentation
+
+%description apidocs
+API and internal documentation for %{name} library.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API biblioteki %{name}.
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+
+%build
+%{__make} \
+ CC="%{__cc}" \
+ CXX="%{__cxx}" \
+ CFLAGS='%{rpmcflags} -Wall -pthread -fPIC $(INCLUDE_DIRS)' \
+ CXXFLAGS='%{rpmcxxflags} -Wall -pthread -fPIC $(INCLUDE_DIRS)' \
+
+%if %{with static_libs}
+%{__make} -C src libslibc.a libslibc++.a
+%endif
+
+%if %{with apidocs}
+doxygen mainpage.dox
+%endif
+
+%{?with_tests:%{__make} test}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+# make install is broken (as of 0.9.2); do it manually
+install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir}/slibc}
+cp -p include/slibc/*.h* $RPM_BUILD_ROOT%{_includedir}/slibc
+cp -dp src/libslibc*.so* $RPM_BUILD_ROOT%{_libdir}
+%if %{with static_libs}
+cp -p src/libslibc*.a $RPM_BUILD_ROOT%{_libdir}
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSES README TODO
+%attr(755,root,root) %{_libdir}/libslibc.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libslibc.so.0
+%attr(755,root,root) %{_libdir}/libslibc++.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libslibc++.so.0
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libslibc.so
+%attr(755,root,root) %{_libdir}/libslibc++.so
+%{_includedir}/slibc
+
+%if %{with static_libs}
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libslibc.a
+%{_libdir}/libslibc++.a
+%endif
+
+%if %{with apidocs}
+%files apidocs
+%defattr(644,root,root,755)
+%doc html/*
+%endif