Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jemalloc : new recipe #1965

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
90 changes: 90 additions & 0 deletions dev-libs/jemalloc/jemalloc-5.0.1.recipe
@@ -0,0 +1,90 @@
SUMMARY="A general-purpose scalable concurrent allocator"
DESCRIPTION="jemalloc is a general purpose malloc(3) implementation that \
emphasizes fragmentation avoidance and scalable concurrency support. \
jemalloc first came into use as the FreeBSD libc allocator in 2005, and since \
then it has found its way into numerous applications that rely on its \
predictable behavior. In 2010 jemalloc development efforts broadened to \
include developer support features such as heap profiling and extensive \
monitoring/tuning hooks. Modern jemalloc releases continue to be integrated \
back into FreeBSD, and therefore versatility remains critical. Ongoing \
development efforts trend toward making jemalloc among the best allocators \
for a broad range of demanding applications, and eliminating/mitigating \
weaknesses that have practical repercussions for real world applications."
HOMEPAGE="https://jemalloc.net/"
COPYRIGHT="2002-2017 Jason Evans
2007-2012 Mozilla Foundation
2009-2017 Facebook, Inc."
LICENSE="BSD (2-clause)"
REVISION="1"
SOURCE_URI="https://github.com/jemalloc/jemalloc/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="5de6dcb50de04b14bae9340d23515390925fcaa7637341707239d09a3ea07a23"
PATCHES="jemalloc-$portVersion.patchset"

ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64"
SECONDARY_ARCHITECTURES="?x86"

PROVIDES="
jemalloc$secondaryArchSuffix = $portVersion compat >= 5
cmd:jemalloc.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I havent looked at anything other than your recipe, but I wonder if it would not be better to rename jemalloc.sh to jemalloc and write:

-	cmd:jemalloc.sh
+	cmd:jemalloc$secondaryArchSuffix
-	cmd:jeprof
+	cmd:jeprof$secondaryArchSuffix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just don't want the executables with _x86 postfix.

cmd:jeprof
lib:libjemalloc$secondaryArchSuffix = 2 compat >= 2
"
REQUIRES="
haiku$secondaryArchSuffix
"

PROVIDES_devel="
jemalloc${secondaryArchSuffix}_devel = $portVersion compat >= 5
cmd:jemalloc_config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write

-		cmd:jemalloc_config
+		cmd:jemalloc_config$secondaryArchSuffix

devel:libjemalloc$secondaryArchSuffix = 2 compat >= 2
devel:libjemalloc_pic$secondaryArchSuffix
"
REQUIRES_devel="
jemalloc$secondaryArchSuffix == $portVersion base
"

BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:awk
cmd:gcc$secondaryArchSuffix
cmd:grep
cmd:ld$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:xsltproc #required
"

defineDebugInfoPackage jemalloc$secondaryArchSuffix \
$libDir/libjemalloc.so.2

BUILD()
{
autoconf
runConfigure ./configure \
--enable-autogen
make $jobArgs
}

INSTALL()
{
make install_bin install_include install_lib

prepareInstalledDevelLibs libjemalloc libjemalloc_pic
fixPkgconfig

# devel package
packageEntries devel \
$developDir \
$prefix/bin/jemalloc-config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use

-		$prefix/bin/jemalloc-config
+		$binDir/jemalloc-config

}

TEST()
{
make check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you will need to pass a LIBRARY_PATH here, probably something like:

 TEST()
 {
+	LIBRARY_PATH="$sourceDir/lib${LIBRARY_PATH:+:$LIBRARY_PATH}" \
 	make check
 }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works already great, no need for more patching here.

}
41 changes: 41 additions & 0 deletions dev-libs/jemalloc/patches/jemalloc-5.0.1.patchset
@@ -0,0 +1,41 @@
From 4f5e6dd0cb8b86e480e5b93a003003c4d3327cd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Tue, 26 Dec 2017 11:27:11 +0100
Subject: [PATCH] Haiku supporting patches

---
configure.ac | 4 ++++
include/jemalloc/internal/jemalloc_internal_decls.h | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1551ded..22f8fbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -549,6 +549,10 @@ case "${host}" in
abi="elf"
force_tls="0"
;;
+ *-*-haiku*)
+ abi="elf"
+ force_tls="0"
+ ;;
*-*-bitrig*)
abi="elf"
;;
diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h
index 8ae5ef4..57824bb 100644
--- a/include/jemalloc/internal/jemalloc_internal_decls.h
+++ b/include/jemalloc/internal/jemalloc_internal_decls.h
@@ -9,7 +9,7 @@
#else
# include <sys/param.h>
# include <sys/mman.h>
-# if !defined(__pnacl__) && !defined(__native_client__)
+# if !defined(__pnacl__) && !defined(__native_client__) && !defined(__HAIKU__)
# include <sys/syscall.h>
# if !defined(SYS_write) && defined(__NR_write)
# define SYS_write __NR_write
--
2.15.1