Add libptmalloc3 from #2667
authorFlorian Fainelli <florian@openwrt.org>
Sun, 9 Nov 2008 17:53:03 +0000 (17:53 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 9 Nov 2008 17:53:03 +0000 (17:53 +0000)
SVN-Revision: 13159

libs/libptmalloc3/Makefile [new file with mode: 0644]
libs/libptmalloc3/patches/100-nothreads.patch [new file with mode: 0644]

diff --git a/libs/libptmalloc3/Makefile b/libs/libptmalloc3/Makefile
new file mode 100644 (file)
index 0000000..a56ebd9
--- /dev/null
@@ -0,0 +1,45 @@
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: $
+#
+# Sample usage:
+#   env LD_PRELOAD="/usr/lib/libptmalloc3.so" <application>
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libptmalloc3
+PKG_VERSION:=20060531
+PKG_RELEASE:=1
+PKG_BUILD_DIR:=$(BUILD_DIR)/ptmalloc3
+
+PKG_SOURCE:=ptmalloc3-current.tar.gz
+PKG_SOURCE_URL:=http://www.malloc.de/malloc/
+PKG_MD5SUM:=c0b9dd5f16f8eae979166dc74b60015c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libptmalloc3
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Efficient malloc implementation
+  URL:=http://www.malloc.de/en/
+endef
+
+# flags: taken from ptmalloc3/Makefile by combining
+# 'linux-shared' and 'linux-nothreads' targets
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               SYS_FLAGS="$(TARGET_CFLAGS)" \
+               linux-shared-nothreads
+endef
+
+define Package/libptmalloc3/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_BUILD_DIR)/libptmalloc3.so $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libptmalloc3))
diff --git a/libs/libptmalloc3/patches/100-nothreads.patch b/libs/libptmalloc3/patches/100-nothreads.patch
new file mode 100644 (file)
index 0000000..d8682de
--- /dev/null
@@ -0,0 +1,20 @@
+This patch adds an additional target to build a shared library without pthreads
+(should this be the default? or is the ulibc malloc threadsafe? or should we
+build two separate packages?)
+
+--- ptmalloc3/Makefile.orig    2007-11-08 09:10:46.000000000 +0000
++++ ptmalloc3/Makefile 2007-11-08 09:17:09.000000000 +0000
+@@ -150,6 +150,13 @@
+  INC_FLAGS='-Isysdeps/pthread -Isysdeps/generic -I.' M_FLAGS='$(M_FLAGS)' \
+  LIB_MALLOC=libptmalloc3.so
++linux-shared-nothreads:
++      $(MAKE) SYS_FLAGS='-D_GNU_SOURCE=1 -fpic' \
++ WARN_FLAGS='-Wall -Wstrict-prototypes' \
++ OPT_FLAGS='$(OPT_FLAGS)' THR_FLAGS='' THR_LIBS='' \
++ INC_FLAGS='-Isysdeps/generic -I.' M_FLAGS='$(M_FLAGS)' \
++ LIB_MALLOC=libptmalloc3.so
++
+ sproc:
+       $(MAKE) THR_FLAGS='' THR_LIBS='' OPT_FLAGS='$(OPT_FLAGS)' CC='$(CC)' \
+       INC_FLAGS='-Isysdeps/sproc -Isysdeps/generic -I.' \