Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Sep 1999 13:26:10 -0400 (EDT)
From:      Mikhail Teterin <mi@aldan.algebra.com>
To:        eischen@vigrid.com, jb@cimlogic.com.au, java@FreeBSD.org, jdp@polstra.com, obrien@FreeBSD.org
Cc:        java-discuss@sourceware.cygnus.com
Subject:   porting libjava to FreeBSD
Message-ID:  <199909251726.NAA44892@rtfm.newton>

next in thread | raw e-mail | index | archive | help
Hello!

I'm  trying to  make a  port of  libjava (to  give some  meaning to  the
currently  useless  gcj installed  by  the  egcs  port on  -stable,  for
example). It also seems to provide A LOT faster java compiler...

Obviously, I'd  like to enable the  use of threads as  well. The closest
match to  c_r in  the set  of possible threading  libraries seems  to be
"Linux threads".

However,  the low  level code  in libgcj-2.95.1/boehm-gc/linux_threads.c
uses the  non-existent (on  FreeBSD) signal  SIGPWR. With  the following
comment:

	/*
	 * The  only way  to suspend  threads given  the pthread
	 * interface is  to send  signals. We can't  use SIGSTOP
	 * directly, because we  need to get the  thread to save
	 * its  stack  pointer in  the  GC  thread table  before
	 * suspending. So we have to reserve a signal of our own
	 * for  this. This  means  we have  to intercept  client
	 * calls  to change  the signal  mask. The  linuxthreads
	 * package already uses SIGUSR1  and SIGUSR2, so we need
	 * to  reuse something  else. I  chose SIGPWR.  (Perhaps
	 * SIGUNUSED would be a better choice.)
	 */
	#define SIG_SUSPEND SIGPWR

Any suggestions on what should be  used on FreeBSD instead? Or, perhaps,
this  is not  going to  work  and a  new freebsd_threads.c  needs to  be
written for libjava? Thanks,

	-mi

P.S. If you  wish to take a  look yourself, here is  the half-baked, but
almost functional port I have so far.

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	libgcj
#	libgcj/pkg
#	libgcj/pkg/COMMENT
#	libgcj/pkg/DESCR
#	libgcj/pkg/PLIST
#	libgcj/patches
#	libgcj/patches/patch-aa
#	libgcj/patches/patch-ab
#	libgcj/patches/patch-ac
#	libgcj/patches/patch-ad
#	libgcj/patches/patch-ae
#	libgcj/files
#	libgcj/files/md5
#	libgcj/Makefile
#	libgcj/work
#	libgcj/work/.extract_done
#	libgcj/work/.patch_done
#	libgcj/work/.configure_done
#
echo c - libgcj
mkdir -p libgcj > /dev/null 2>&1
echo c - libgcj/pkg
mkdir -p libgcj/pkg > /dev/null 2>&1
echo x - libgcj/pkg/COMMENT
sed 's/^X//' >libgcj/pkg/COMMENT << 'END-of-libgcj/pkg/COMMENT'
XGNU Java Library -- needed by GNU Java Compiler (gcj)
END-of-libgcj/pkg/COMMENT
echo x - libgcj/pkg/DESCR
sed 's/^X//' >libgcj/pkg/DESCR << 'END-of-libgcj/pkg/DESCR'
XThis library enables you to use gcj -- now part of the GNU Compiler
XSuit. Threading support is not ported yet.
END-of-libgcj/pkg/DESCR
echo x - libgcj/pkg/PLIST
sed 's/^X//' >libgcj/pkg/PLIST << 'END-of-libgcj/pkg/PLIST'
END-of-libgcj/pkg/PLIST
echo c - libgcj/patches
mkdir -p libgcj/patches > /dev/null 2>&1
echo x - libgcj/patches/patch-aa
sed 's/^X//' >libgcj/patches/patch-aa << 'END-of-libgcj/patches/patch-aa'
X--- ../libjava/configure.orig	Sat Aug 21 10:26:13 1999
X+++ ../libjava/configure	Sat Sep 25 12:29:35 1999
X@@ -2541,3 +2541,3 @@
X-    *-*-linux*)
X+    *-*-linux*|*-*-freebsd*)
X        # FIXME: this isn't correct in all cases.
X        THREADS=posix
X@@ -2570,3 +2570,3 @@
X     THREADS=posix
X     case "$host" in
X-     *-*-linux*)
X+     *-*-linux*|*-*-freebsd*)
X@@ -2597,4 +2597,12 @@
X case "$THREADS" in
X  posix)
X-    THREADLIBS=-lpthread
X-    THREADSPEC=-lpthread
X+    case "$host" in
X+      *-*-linux*)
X+	THREADLIBS=-lpthread
X+	THREADSPEC=-lpthread
X+	;;
X+      *-*-freebsd*)
X+	THREADLIBS=-lc_r
X+	THREADSPEC=-pthread
X+	;;
X+    esac
END-of-libgcj/patches/patch-aa
echo x - libgcj/patches/patch-ab
sed 's/^X//' >libgcj/patches/patch-ab << 'END-of-libgcj/patches/patch-ab'
X--- ../Makefile.in.orig	Wed May  5 06:13:21 1999
X+++ ../Makefile.in	Sat Sep 25 11:14:08 1999
X@@ -65 +64,0 @@
X-INSTALL = $(SHELL) $$s/install-sh -c
END-of-libgcj/patches/patch-ab
echo x - libgcj/patches/patch-ac
sed 's/^X//' >libgcj/patches/patch-ac << 'END-of-libgcj/patches/patch-ac'
X--- ../libjava/Makefile.in.orig	Mon Aug  2 23:14:26 1999
X+++ ../libjava/Makefile.in	Sat Sep 25 12:12:15 1999
X@@ -131,6 +131 @@
X-@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = \
X-@CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
X-@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = \
X-@CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
X-@CANADIAN_FALSE@ZIP = \
X-@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
X+ZIP = ${PREFIX}/bin/zip
END-of-libgcj/patches/patch-ac
echo x - libgcj/patches/patch-ad
sed 's/^X//' >libgcj/patches/patch-ad << 'END-of-libgcj/patches/patch-ad'
X--- ../boehm-gc/configure.orig	Wed Aug  4 16:53:52 1999
X+++ ../boehm-gc/configure	Sat Sep 25 12:33:47 1999
X@@ -2273,3 +2273,3 @@
X-    *-*-linux*)
X+    *-*-linux*|*-*-freebsd*)
X        # FIXME: this isn't correct in all cases.
X        THREADS=posix
X@@ -2303,3 +2303,3 @@
X     THREADS=posix
X     case "$host" in
X-     *-*-linux*)
X+     *-*-linux*|*-*-freebsd*)
END-of-libgcj/patches/patch-ad
echo x - libgcj/patches/patch-ae
sed 's/^X//' >libgcj/patches/patch-ae << 'END-of-libgcj/patches/patch-ae'
X--- ../boehm-gc/config.h.orig	Mon Jul 19 15:32:38 1999
X+++ ../boehm-gc/config.h	Sat Sep 25 12:41:24 1999
X@@ -989,3 +989,3 @@
X # endif
X-# if defined(LINUX_THREADS) && !defined(LINUX)
X+# if defined(LINUX_THREADS) && !defined(LINUX) && !defined(__FreeBSD__)
X --> inconsistent configuration
END-of-libgcj/patches/patch-ae
echo c - libgcj/files
mkdir -p libgcj/files > /dev/null 2>&1
echo x - libgcj/files/md5
sed 's/^X//' >libgcj/files/md5 << 'END-of-libgcj/files/md5'
XMD5 (libgcj-2.95.1.tar.gz) = 63f61b33ef099caf55ec55553a668576
END-of-libgcj/files/md5
echo x - libgcj/Makefile
sed 's/^X//' >libgcj/Makefile << 'END-of-libgcj/Makefile'
X# New ports collection makefile for:    Java Servlet Developpers Kit
X# Version required:	2.95.1
X# Date created:		1999/09/23
X# Whom:			Mikhail Teterin <mi@aldan.algebra.com>
X#
X# $FreeBSD:$
X#
X
XDISTNAME=	libgcj-2.95.1
XCATEGORIES=	java
XMASTER_SITES=	ftp://sourceware.cygnus.com/pub/java/
X
XMAINTAINER=	mi@aldan.algebra.com
X
XBUILD_DEPENDS=	g++295:${PORTSDIR}/lang/egcs \
X		gcj:${PORTSDIR}/lang/egcs \
X		zip:${PORTSDIR}/archivers/zip
X
XGNU_CONFIGURE=	YES
XUSE_GMAKE=	YES
XCONFIGURE_SCRIPT=../configure
XCONFIGURE_ENV=	CC=gcc295 CXX=g++295 CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}"
XCONFIGURE_ARGS=	--with-system-zlib
X
X.if defined(USE_THREADS)
X# Currently broken!
XCONFIGURE_ARGS+=--enable-threads=posix
X.endif
X
XMAKE_ENV=	INSTALL="${INSTALL}" PREFIX="${PREFIX}"
X
XWRKSRC=		${WRKDIR}/libgcj-2.95.1/build
X
Xpost-extract:
X	${MKDIR} ${WRKSRC}
X	${RM} -rf ${WRKSRC}/../zip ${WRKSRC}/../zlib
X
Xpost-configure:
X	cd ${WRKSRC} && ${GMAKE} configure-target-boehm-gc \
X				configure-target-libjava
X
X.include <bsd.port.mk>
END-of-libgcj/Makefile
exit


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909251726.NAA44892>