Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b5ea997
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,113 @@
+#
+# Copyright (c) 2010-2014 Nest, Inc.
+# All rights reserved.
+#
+# This document is the property of Nest. It is considered
+# confidential and proprietary information.
+#
+# This document may not be reproduced or transmitted in any form,
+# in whole or in part, without the express written permission of
+# Nest.
+#
+# Description:
+# This file is the make file for dmalloc,
+#
+
+
+include pre.mak
+
+PackageName := dmalloc
+
+PackageExtension := tar.gz
+PackageSeparator := -
+
+PackagePatchArgs := -p1
+
+PackageArchive := $(PackageName).$(PackageExtension)
+PackageSourceDir := $(call GenerateBuildPaths,$(PackageName)$(PackageSeparator)$(PackageVersion))
+
+LicenseSourceFile := $(PackageSourceDir)/COPYING
+
+CleanPaths += $(PackageLicenseFile)
+
+SOURCEDIRS = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(LicenseSourceFile): $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(LicenseSourceFile)
+ $(copy-result)
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths) | $(BuildDirectory)
+ $(call expand-archive,$(PackageArchive),$(dir $(@)))
+ $(call patch-directory,$(@),$(PackagePatchArgs),$(PackagePatchPaths))
+ $(Verbose)touch $(@)
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir)
+ $(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+ $(Verbose)touch $@
+
+# Generate the package build makefile.
+
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory) $(ResultDirectory)
+ $(Verbose)cd $(BuildDirectory) && \
+ autoconf -o $(CURDIR)/$(PackageSourceDir)/configure $(CURDIR)/$(PackageSourceDir)/configure.ac && \
+ $(CURDIR)/$(PackageSourceDir)/configure \
+ CC="$(CC) $(CPPOPTFLAGS)" CXX="$(CXX) $(CPPOPTFLAGS)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+ CPPFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncludePath))" \
+ --build=$(HostTuple) \
+ --host=$(TargetTuple) \
+ --target=$(TargetTuple) \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --enable-threads \
+ --with-abort-okay \
+ --with-pagesize=12 \
+ --with-return-macros \
+ --with-strdup-macro \
+ $(NULL)
+ $(Verbose)touch $@
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) -C $(BuildDirectory) \
+ all
+ $(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) -C $(BuildDirectory) DESTDIR=$(ResultDirectory) install
+ $(Verbose)touch $@
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage
+
+clean:
+ $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/dmalloc.patches/dmalloc-50.description b/dmalloc.patches/dmalloc-50.description
new file mode 100644
index 0000000..a3ae65b
--- /dev/null
+++ b/dmalloc.patches/dmalloc-50.description
@@ -0,0 +1 @@
+Fix cross-compiling.
diff --git a/dmalloc.patches/dmalloc-50.patch b/dmalloc.patches/dmalloc-50.patch
new file mode 100644
index 0000000..ba7f765
--- /dev/null
+++ b/dmalloc.patches/dmalloc-50.patch
@@ -0,0 +1,180 @@
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac 2007-05-14 10:26:14.000000000 -0700
++++ b/configure.ac 2016-05-14 18:42:26.261439471 -0700
+@@ -56,7 +56,7 @@
+ AC_PROG_CXX
+
+ # see if we actually have a CXX program
+-if test "$ac_cv_prog_CXX" = "" -o ! -x "$ac_cv_prog_CXX"; then
++if test "$ac_cv_prog_CXX" = "" -o ! "$ac_cv_prog_CXX" --version &>/dev/null ; then
+ AC_MSG_WARN(could not find C++ compiler $ac_cv_prog_CXX)
+ enable_cxx=no
+ fi
+@@ -263,6 +263,10 @@
+ # check for strdup macro (linux)
+ #
+ AC_MSG_CHECKING([strdup macro])
++AC_ARG_WITH(strdup-macro,
++ [ AC_HELP_STRING([--with-strdup-macro],
++ [override strdup macro detection] ) ],
++ [ ac_cv_strdup_macro="$withval" ], [
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #if HAVE_STDLIB_H
+ # include <string.h>
+@@ -278,6 +282,7 @@
+ [ac_cv_strdup_macro=no],
+ [ac_cv_strdup_macro=no]
+ )
++],)
+ AC_MSG_RESULT([$ac_cv_strdup_macro])
+
+ #
+@@ -349,6 +354,12 @@
+ AC_CHECK_FUNCS(getpagesize)
+ AC_MSG_CHECKING([basic-block size])
+ ac_cv_page_size=0
++AC_ARG_WITH(pagesize,
++ [ AC_HELP_STRING([--with-pagesize=nbits],
++ [log base 2 of machine page size] ) ],
++ [ case "$withval" in ?|1?) ac_cv_page_size=$withval; esac ],
++ [ : # default to probing, set above ],
++)
+ if test $ac_cv_page_size = 0; then
+ AC_RUN_IFELSE([main() { if (getpagesize()<=2048) exit(0); else exit(1); }],
+ [ ac_cv_page_size=11 ] )
+@@ -389,6 +400,10 @@
+ # check the safety of the abort function
+ #
+ AC_CHECK_FUNCS(abort)
++AC_ARG_WITH(abort-okay,
++ [ AC_HELP_STRING([--with-abort-okay],
++ [override abort okay detection] ) ],
++ [ AC_DEFINE(ABORT_OKAY, 1) AC_MSG_RESULT([yes]) ], [
+ AC_MSG_CHECKING([abort safe])
+ AC_RUN_IFELSE([[
+ static int main_b = 0;
+@@ -429,6 +444,7 @@
+ [ AC_DEFINE(ABORT_OKAY, 1) AC_MSG_RESULT([yes]) ],
+ [ AC_DEFINE(ABORT_OKAY, 0) AC_MSG_RESULT([no]) ]
+ )
++],)
+
+ AC_TYPE_SIGNAL
+ AC_MSG_CHECKING([signal works])
+@@ -593,6 +609,10 @@
+ #
+ # check if the return.h macros work
+ #
++AC_ARG_WITH(return-macros,
++ [ AC_HELP_STRING([--with-return-macros],
++ [override return macros detection] ) ],
++ [ AC_DEFINE(RETURN_MACROS_WORK, 1) AC_MSG_RESULT([yes]) ], [
+ AC_MSG_CHECKING([return.h macros work])
+ AC_RUN_IFELSE([
+
+@@ -618,6 +638,7 @@
+ [ AC_DEFINE(RETURN_MACROS_WORK, 0) AC_MSG_RESULT([no]) ],
+ [ AC_DEFINE(RETURN_MACROS_WORK, 0) AC_MSG_RESULT([no]) ]
+ )
++],)
+
+ ##############################################################################
+
+diff -ur a/Makefile.in b/Makefile.in
+--- a/Makefile.in 2007-05-14 10:26:14.000000000 -0700
++++ b/Makefile.in 2016-05-14 17:39:10.740821762 -0700
+@@ -174,66 +174,66 @@
+ # rm -f configure
+
+ installdirs :
+- $(srcdir)/mkinstalldirs $(includedir) $(libdir) $(bindir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(includedir) $(DESTDIR)/$(libdir) $(DESTDIR)/$(bindir)
+
+ installincs : $(HFLS)
+- $(srcdir)/mkinstalldirs $(includedir)
+- $(INSTALL_DATA) $(HFLS) $(includedir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(includedir)
++ $(INSTALL_DATA) $(HFLS) $(DESTDIR)/$(includedir)
+
+ installthsl : $(LIB_TH_SL)
+- $(srcdir)/mkinstalldirs $(libdir)
+- $(INSTALL_PROGRAM) $(LIB_TH_SL) $(libdir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir)
++ $(INSTALL_PROGRAM) $(LIB_TH_SL) $(DESTDIR)/$(libdir)
+
+ installth : $(INSTALL_THREADS)
+- $(srcdir)/mkinstalldirs $(libdir)
+- $(INSTALL_PROGRAM) $(LIB_TH) $(libdir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir)
++ $(INSTALL_PROGRAM) $(LIB_TH) $(DESTDIR)/$(libdir)
+ @CXX_OFF@ @echo "Enter 'make installthcxx' to install the threaded C++ library"
+ @SL_OFF@ @echo "Enter 'make installthsl' to install the threaded shared-library"
+
+ installthcxxsl : $(LIB_TH_CXX_SL)
+- $(srcdir)/mkinstalldirs $(shlibdir)
+- $(INSTALL_PROGRAM) $(LIB_TH_CXX_SL) $(shlibdir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(shlibdir)
++ $(INSTALL_PROGRAM) $(LIB_TH_CXX_SL) $(DESTDIR)/$(shlibdir)
+
+ installthcxx : $(INSTALL_TH_CXX)
+- $(srcdir)/mkinstalldirs $(libdir)
+- $(INSTALL_PROGRAM) $(LIB_TH_CXX) $(libdir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir)
++ $(INSTALL_PROGRAM) $(LIB_TH_CXX) $(DESTDIR)/$(libdir)
+ @SL_OFF@ @echo "Enter 'make installthcxxsl' to install the threaded C++ shared-library"
+
+ installcxxsl : $(LIB_CXX_SL)
+- $(srcdir)/mkinstalldirs $(libdir)
+- $(INSTALL_PROGRAM) $(LIB_CXX_SL) $(libdir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir)
++ $(INSTALL_PROGRAM) $(LIB_CXX_SL) $(DESTDIR)/$(libdir)
+
+ installcxx : $(INSTALL_CXX)
+- $(srcdir)/mkinstalldirs $(libdir)
+- $(INSTALL_PROGRAM) $(LIB_CXX) $(libdir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir)
++ $(INSTALL_PROGRAM) $(LIB_CXX) $(DESTDIR)/$(libdir)
+ @TH_OFF@ @echo "Enter 'make installthcxx' to install the threaded C++ library"
+ @SL_OFF@ @echo "Enter 'make installcxxsl' to install the C++ shared-library"
+
+ installsl : $(LIB_SL)
+- $(srcdir)/mkinstalldirs $(shlibdir)
+- $(INSTALL_PROGRAM) $(LIB_SL) $(shlibdir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(shlibdir)
++ $(INSTALL_PROGRAM) $(LIB_SL) $(DESTDIR)/$(shlibdir)
+ @CXX_OFF@ @echo "Enter 'make installcxxsl' to install the C++ shared-library"
+ @TH_OFF@ @echo "Enter 'make installthsl' to install thread shared-library"
+
+ installlib : $(INSTALL_LIB)
+- $(srcdir)/mkinstalldirs $(libdir)
+- $(INSTALL_PROGRAM) $(LIBRARY) $(libdir)
+- @RANLIB@ $(libdir)/$(LIBRARY)
+-@SL_OFF@ @echo "Enter 'make installsl' to install $(LIB_SL) in $(shlibdir)"
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(libdir)
++ $(INSTALL_PROGRAM) $(LIBRARY) $(DESTDIR)/$(libdir)
++ @RANLIB@ $(DESTDIR)/$(libdir)/$(LIBRARY)
++@SL_OFF@ @echo "Enter 'make installsl' to install $(LIB_SL) in $(DESTDIR)/$(shlibdir)"
+ @CXX_OFF@ @echo "Enter 'make installcxx' to install the C++ library"
+ @TH_OFF@ @echo "Enter 'make installth' to install thread library"
+
+ installdocs : $(srcdir)/docs/$(HTMLFILE) $(srcdir)/docs/$(TEXIFILE) \
+ $(srcdir)/docs/$(PDFFILE)
+- $(srcdir)/mkinstalldirs $(docdir)
+- $(INSTALL_DATA) $(srcdir)/docs/$(HTMLFILE) $(docdir)
+- $(INSTALL_DATA) $(srcdir)/docs/$(TEXIFILE) $(docdir)
+- $(INSTALL_DATA) $(srcdir)/docs/$(PDFFILE) $(docdir)
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(docdir)
++ $(INSTALL_DATA) $(srcdir)/docs/$(HTMLFILE) $(DESTDIR)/$(docdir)
++ $(INSTALL_DATA) $(srcdir)/docs/$(TEXIFILE) $(DESTDIR)/$(docdir)
++ $(INSTALL_DATA) $(srcdir)/docs/$(PDFFILE) $(DESTDIR)/$(docdir)
+
+ install : installincs installlib $(UTIL)
+- $(srcdir)/mkinstalldirs $(bindir)
+- $(INSTALL_PROGRAM) $(UTIL) $(bindir)
+- @echo "Enter 'make installdocs' to install $(DOCFILES) in $(docdir)"
++ $(srcdir)/mkinstalldirs $(DESTDIR)/$(bindir)
++ $(INSTALL_PROGRAM) $(UTIL) $(DESTDIR)/$(bindir)
++ @echo "Enter 'make installdocs' to install $(DOCFILES) in $(DESTDIR)/$(docdir)"
+
+ dmalloc.h.2 : $(srcdir)/configure
+ $(SHELL) $(srcdir)/configure
diff --git a/dmalloc.patches/dmalloc-51.description b/dmalloc.patches/dmalloc-51.description
new file mode 100644
index 0000000..7497866
--- /dev/null
+++ b/dmalloc.patches/dmalloc-51.description
@@ -0,0 +1 @@
+Add posix_memalign Support
diff --git a/dmalloc.patches/dmalloc-51.patch b/dmalloc.patches/dmalloc-51.patch
new file mode 100644
index 0000000..d6cf05d
--- /dev/null
+++ b/dmalloc.patches/dmalloc-51.patch
@@ -0,0 +1,55 @@
+diff -ur a/malloc.c b/malloc.c
+--- a/malloc.c 2007-05-14 10:26:14.000000000 -0700
++++ b/malloc.c 2016-05-13 17:02:10.141760950 -0700
+@@ -81,6 +81,8 @@
+ #include <signal.h>
+ #endif
+
++#include <errno.h>
++
+ #define DMALLOC_DISABLE
+
+ #include "dmalloc.h"
+@@ -1209,6 +1211,30 @@
+ 0 /* no xalloc messages */);
+ }
+
++#undef posix_memalign
++int posix_memalign(DMALLOC_PNT *ppnt, DMALLOC_SIZE alignment, DMALLOC_SIZE size)
++{
++ int ret = 0;;
++ DMALLOC_PNT pnt;
++
++ if ((alignment & (alignment - 1)) != 0) {
++ ret = -EINVAL;
++ }
++
++ if (ret >= 0) {
++ pnt = memalign(alignment, size);
++ if (pnt == NULL) {
++ ret = -ENOMEM;
++ }
++ }
++
++ if (ret >= 0) {
++ *ppnt = pnt;
++ }
++
++ return ret;
++}
++
+ /*
+ * DMALLOC_PNT valloc
+ *
+diff -ur a/malloc_funcs.h b/malloc_funcs.h
+--- a/malloc_funcs.h 2007-05-14 10:26:14.000000000 -0700
++++ b/malloc_funcs.h 2016-05-13 17:01:21.817144140 -0700
+@@ -129,6 +129,8 @@
+ */
+ extern
+ DMALLOC_PNT memalign(DMALLOC_SIZE alignment, DMALLOC_SIZE size);
++extern
++int posix_memalign(DMALLOC_PNT *ppnt, DMALLOC_SIZE alignment, DMALLOC_SIZE size);
+
+ /*
+ * Allocate and return a SIZE block of bytes that has been aligned to
diff --git a/dmalloc.patches/dmalloc-52.description b/dmalloc.patches/dmalloc-52.description
new file mode 100644
index 0000000..a998755
--- /dev/null
+++ b/dmalloc.patches/dmalloc-52.description
@@ -0,0 +1 @@
+Disable Free Null Message
diff --git a/dmalloc.patches/dmalloc-52.patch b/dmalloc.patches/dmalloc-52.patch
new file mode 100644
index 0000000..0c1ba0c
--- /dev/null
+++ b/dmalloc.patches/dmalloc-52.patch
@@ -0,0 +1,12 @@
+diff -ur a/settings.dist b/settings.dist
+--- a/settings.dist 2007-05-14 10:26:14.000000000 -0700
++++ b/settings.dist 2016-05-15 10:52:15.844959444 -0700
+@@ -78,7 +78,7 @@
+ * generate an exception when it sees a free(0L).
+ */
+ #define ALLOW_FREE_NULL 1
+-#define ALLOW_FREE_NULL_MESSAGE 1
++#define ALLOW_FREE_NULL_MESSAGE 0
+
+ /*
+ * Should we use the ra-address macros in return.h. These are system
diff --git a/dmalloc.tar.gz b/dmalloc.tar.gz
new file mode 100644
index 0000000..4e19078
--- /dev/null
+++ b/dmalloc.tar.gz
Binary files differ
diff --git a/dmalloc.url b/dmalloc.url
new file mode 100644
index 0000000..4493150
--- /dev/null
+++ b/dmalloc.url
@@ -0,0 +1 @@
+http://dmalloc.com/releases/dmalloc-5.5.2.tgz
diff --git a/dmalloc.version b/dmalloc.version
new file mode 100644
index 0000000..e4d41db
--- /dev/null
+++ b/dmalloc.version
@@ -0,0 +1 @@
+5.5.2