diff --git a/0001-Fix-build-problem-on-linux.patch b/0001-Fix-build-problem-on-linux.patch new file mode 100644 index 0000000000000000000000000000000000000000..6139d3c29d11f189ed7591cb8be825d66953c40a --- /dev/null +++ b/0001-Fix-build-problem-on-linux.patch @@ -0,0 +1,50 @@ +From 3b0b2cef2b58db96ab846d3d03bec8ca0a0c7762 Mon Sep 17 00:00:00 2001 +From: luocheng <1264148725@qq.com> +Date: Thu, 26 Nov 2020 20:33:11 +0800 +Subject: [PATCH] Fix build problem on linux + +--- + Makefile.am | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index ddcbbf8..f56d960 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,16 +1,16 @@ +-lib_LTLIBRARIES = libumem.la libumem_malloc.la ++lib_LTLIBRARIES = libumem.la + noinst_PROGRAMS = umem_test umem_test2 umem_test3 + + libumem_la_LDFLAGS = -lpthread -ldl + + umem_test_SOURCES = umem_test.c +-umem_test_LDADD = -lumem ++umem_test_LDADD = $(lib_LTLIBRARIES) + + umem_test2_SOURCES = umem_test2.c +-umem_test2_LDADD = -lumem ++umem_test2_LDADD = $(lib_LTLIBRARIES) + + umem_test3_SOURCES = umem_test3.c +-umem_test3_LDADD = -lumem -lumem_malloc ++umem_test3_LDADD = $(lib_LTLIBRARIES) + + libumem_la_SOURCES = init_lib.c \ + umem_agent_support.c \ +@@ -33,10 +33,8 @@ libumem_la_SOURCES = init_lib.c \ + sol_compat.h \ + vmem.c \ + sys/vmem.h \ +- sys/vmem_impl_user.h +- +-libumem_malloc_la_SOURCES = malloc.c +-libumem_malloc_la_LDFLAGS = -lpthread -ldl -R$(libdir) -lumem ++ sys/vmem_impl_user.h \ ++ malloc.c + + man3_MANS = umem_alloc.3 umem_cache_create.3 umem_debug.3 + EXTRA_DIST = COPYRIGHT OPENSOLARIS.LICENSE umem.spec Doxyfile umem_test4 \ +-- +1.8.3.1 + diff --git a/libumem-1.0.tar.gz b/libumem-1.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..009886e822b3a7b50b37d975de72cf11f7008dee Binary files /dev/null and b/libumem-1.0.tar.gz differ diff --git a/libumem.spec b/libumem.spec new file mode 100644 index 0000000000000000000000000000000000000000..53b706164db38311631cedcdbd015931dae323ad --- /dev/null +++ b/libumem.spec @@ -0,0 +1,109 @@ +%define debug_package %{nil} +%define Minortag 1.0.1 + +Name: libumem +Version: 1.0 +Release: 1%{?dist} +Summary: Port of Solaris's slab allocator. + +Group: System Environment/Libraries +License: CDDL +URL: https://github.com/omniti-labs/portableumem +Source0: %{name}-%{version}.tar.gz +Patch9000: 0001-Fix-build-problem-on-linux.patch + +BuildRequires: autoconf >= 2.50 +BuildRequires: automake >= 1.4 +BuildRequires: libtool >= 1.4.2 +BuildRequires: doxygen +BuildRequires: gcc +BuildRequires: binutils +BuildRequires: make +BuildRequires: mktemp + +ExclusiveArch: x86_64 + +%description +This a port of Solaris's slab allocator, libumem, to Linux. + +"A slab allocator is a cache management structure for efficient use +of [...] memory. [...] It is targeted for use of many small pieces +of memory chunks. By managing small memory chunks in the units +called slabs, this mechanism enables lower fragmentation, fast allocation, +and reclaming memory." (Description sourced from Wikipedia.) + +%package devel +Summary: Port of Solaris's slab allocator. +Group: Development/Libraries +Requires: pkgconfig + +%description devel +This contains the libraries and header files for using this port +of Solaris's slab allocator, libumem, to Linux. + +%prep +%autosetup -n %{name}-%{version}/%{Minortag} -p1 + +%build +./autogen.sh +%configure +%{__make} -j +%{__make} check +%{__make} html + +%install +rm -rf $RPM_BUILD_ROOT +%makeinstall + +# Remove the libtool files -- we don't want them. +find $RPM_BUILD_ROOT%{_libdir} -name '*.la' | xargs rm -fv + +# Remove the symlink to the SONAME. Let ldconfig manage that. +rm -fv $RPM_BUILD_ROOT%{_libdir}/*.so.[0-9] + +# Build the pkgconfig configurations. +mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig + +cat<$RPM_BUILD_ROOT%{_libdir}/pkgconfig/%{name}-%{version}.pc +prefix=%{_prefix} +exec_prefix=%{_exec_prefix} +libdir=%{_libdir} +includedir=%{_includedir} + +Name: %{name} +Version: %{version} +Description: Port of Solaris's slab allocator. +URL: https://labs.omniti.com/trac/portableumem/ +Requires: +Libs: -L\${libdir} -lumem +Cflags: +EOT + +%clean +rm -rf $RPM_BUILD_ROOT + +%pre +/sbin/ldconfig + +%post +/sbin/ldconfig + +%files +%defattr(-,root,root,-) +%doc AUTHORS COPYING COPYRIGHT INSTALL NEWS OPENSOLARIS.LICENSE README +%{_libdir}/*.so.* + +%files devel +%defattr(-,root,root,-) +%doc AUTHORS COPYING COPYRIGHT INSTALL NEWS OPENSOLARIS.LICENSE README TODO +%doc docs/html +%{_includedir}/*.h +%{_includedir}/sys/*.h +%{_libdir}/*.so +%{_libdir}/*.a +%{_mandir}/man*/* +%{_libdir}/pkgconfig/*.pc + +%changelog +* Fri Nov 27 2020 luocheng <1264148725@qq.com> - 1.0.1-1 +- Package init