Skip to content

Commit

Permalink
fix some issues with boehm-gc builds
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Oct 28, 2021
1 parent 83e73d0 commit 2e3bc44
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 5 deletions.
7 changes: 3 additions & 4 deletions devel/boehm-gc/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

PORTNAME= gc
PORTVERSION= 8.0.6
CATEGORIES= devel
Expand All @@ -16,15 +15,15 @@ LICENSE_NAME= Boehm-Demers-Weiser Garbage Collector License
LICENSE_TEXT= License can be found at http://www.hboehm.info/gc/license.txt
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

BUILD_DEPENDS= ${LOCALBASE}/lib/libatomic_ops.a:${PORTSDIR}/devel/libatomic_ops
BUILD_DEPENDS= ${LOCALBASE}/lib/libatomic_ops.a:devel/libatomic_ops

GNU_CONFIGURE= yes
USES= cpe libtool pathfix pkgconfig
CPE_VENDOR= boehm-demers-weiser
CPE_PRODUCT= garbage_collector
USE_LDCONFIG= yes
INSTALL_TARGET= install-strip
CONFIGURE_ARGS= --enable-cplusplus
CONFIGURE_ARGS= --enable-cplusplus --enable-static
MAKE_JOBS_UNSAFE= yes

WRKSRC= ${WRKDIR}/${DISTNAME:C/[a-z]$//}
Expand All @@ -40,7 +39,7 @@ PLIST_FILES= ${INSTLIBS:S,^,lib/lib,:S,$,-${GC_VARIANT}.so,} \
lib/libgc-${GC_VARIANT}.so.1.4.4 \
lib/libgccpp-${GC_VARIANT}.so.1.4.1 \
libdata/pkgconfig/bdw-gc-${GC_VARIANT}.pc
RUN_DEPENDS+= ${LOCALBASE}/include/gc/gc.h:${PORTSDIR}/devel/boehm-gc
RUN_DEPENDS+= ${LOCALBASE}/include/gc/gc.h:devel/boehm-gc
. if ${GC_VARIANT} == "redirect"
CONFIGURE_ARGS+=--disable-threads --enable-redirect-malloc
. endif
Expand Down
12 changes: 12 additions & 0 deletions devel/boehm-gc/files/patch-configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- configure.orig 2014-06-03 20:08:54 UTC

This comment has been minimized.

Copy link
@ivmai

ivmai Sep 1, 2022

Contributor

@laffer1, why is this patch needed? USE_MMAP is defined by default in v8.0.0+

This comment has been minimized.

Copy link
@laffer1

laffer1 Sep 1, 2022

Author Member

Doesn't appear to be needed anymore. Probably just got carried over from old versions. I've removed it

+++ configure
@@ -15639,6 +15639,9 @@ else
fi

case "${host}" in
+ *-freebsd*|*-midnightbsd*)
+ gc_use_mmap=yes
+ ;;
*-linux*)
# FIXME: This seems to be no longer needed as configured in gcconfig.h
#gc_use_mmap=yes
15 changes: 15 additions & 0 deletions devel/boehm-gc/files/patch-include_gc_pthread_redirects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- include/gc_pthread_redirects.h.orig 2018-12-23 21:28:41 UTC
+++ include/gc_pthread_redirects.h
@@ -53,12 +53,8 @@
# endif /* !GC_NO_DLOPEN */

# ifndef GC_NO_PTHREAD_SIGMASK
-# if defined(GC_PTHREAD_SIGMASK_NEEDED) \

This comment has been minimized.

Copy link
@ivmai

ivmai Sep 16, 2022

Contributor

@laffer1 What was the build failure regarding this change? I could easily upstream it but how does it help. Because pthread_sigmask is declared in MidnightBSD (I understand correctly) only if _POSIX_C_SOURCE >= 199506L or _XOPEN_SOURCE >= 500.
[1] https://github.com/MidnightBSD/src/blob/2ec947db3f6a4189e95eb81babc7da42ee75dde4/include/signal.h#L77
[2] https://github.com/MidnightBSD/src/blob/c800204be1d87ec62baf064522d3de05e1e91896/sys/sys/cdefs.h#L692
[3] https://github.com/MidnightBSD/src/blob/c800204be1d87ec62baf064522d3de05e1e91896/sys/sys/cdefs.h#L714

This comment has been minimized.

Copy link
@laffer1

laffer1 Sep 27, 2022

Author Member

yeah that doesn't seem needed. i removed this

- || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) \
- || (_POSIX_C_SOURCE >= 199506L) || (_XOPEN_SOURCE >= 500)
GC_API int GC_pthread_sigmask(int /* how */, const sigset_t *,
sigset_t * /* oset */);
-# endif
# endif /* !GC_NO_PTHREAD_SIGMASK */

# ifndef GC_PTHREAD_CREATE_CONST
40 changes: 40 additions & 0 deletions devel/boehm-gc/files/patch-include_private_gcconfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--- include/private/gcconfig.h.orig 2020-11-21 06:02:51 UTC
+++ include/private/gcconfig.h
@@ -239,7 +239,7 @@ EXTERN_C_BEGIN
# define EWS4800
# endif
# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD) \
- && !defined(OPENBSD)
+ && !defined(OPENBSD) && !defined(FREEBSD)
# if defined(ultrix) || defined(__ultrix)
# define ULTRIX
# else
@@ -670,7 +670,7 @@ EXTERN_C_BEGIN
# endif
# define mach_type_known
# endif
-# if defined(__riscv) && defined(LINUX)
+# if defined(__riscv)
# define RISCV
# define mach_type_known
# endif
@@ -2883,6 +2883,19 @@ EXTERN_C_BEGIN
# define DATASTART ((ptr_t)__data_start)
# define LINUX_STACKBOTTOM
# define DYNAMIC_LOADING
+# endif
+# ifdef FREEBSD
+# define OS_TYPE "FREEBSD"
+# ifndef GC_FREEBSD_THREADS
+# define MPROTECT_VDB
+# endif
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# define FREEBSD_STACKBOTTOM
+# define DYNAMIC_LOADING
+ extern char etext[];
+# define DATASTART GC_FreeBSDGetDataStart(0x1000, (ptr_t)etext)
+# define DATASTART_USES_BSDGETDATASTART
# endif
# endif /* RISCV */

2 changes: 1 addition & 1 deletion devel/boehm-gc/pkg-descr
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ such source code modifications. See the man page and header files.

ps: garbage collection is addictive.

WWW: http://www.hboehm.info/gc/
WWW: https://www.hboehm.info/gc/
3 changes: 3 additions & 0 deletions devel/boehm-gc/pkg-plist
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ include/gc/gc_version.h
include/gc/javaxfc.h
include/gc/leak_detector.h
include/gc_cpp.h
lib/libcord.a
lib/libcord.so
lib/libcord.so.1
lib/libcord.so.1.4.0
lib/libgc.a
lib/libgc.so
lib/libgc.so.1
lib/libgc.so.1.4.4
lib/libgccpp.a
lib/libgccpp.so
lib/libgccpp.so.1
lib/libgccpp.so.1.4.1
Expand Down

0 comments on commit 2e3bc44

Please sign in to comment.