summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Egge <tegge@FreeBSD.org>2002-06-08 18:27:19 +0000
committerTor Egge <tegge@FreeBSD.org>2002-06-08 18:27:19 +0000
commit7c73d7524cc42ca777cf49b8a93ee244289db5a7 (patch)
tree20fc047a242e344c7ad1794f4e9c31187bb87d42
parentdevel/ruby-strscan has been replaced with lang/ruby16-shim-ruby18. (diff)
Build linuxthreads version of libstdc++ and libsupc++ under 5.0-CURRENT.
Don't misuse DESTDIR when building linuxthreads version of libgcc. Fix varargs warning under 5.0-CURRENT. Don't try to register profiled libraries when NOPROFILE has been specified. Don't try to register shared libraries when NOPIC has been specified. Bump port revision. PR: 38876
Notes
Notes: svn path=/head/; revision=60883
-rw-r--r--devel/linuxthreads/Makefile93
-rw-r--r--devel/linuxthreads/files/Makefile.libgcc_r17
-rw-r--r--devel/linuxthreads/files/Makefile.libstdc++18
-rw-r--r--devel/linuxthreads/files/Makefile.libsupc++18
-rw-r--r--devel/linuxthreads/files/README.FreeBSD12
-rw-r--r--devel/linuxthreads/files/patch-aa21
-rw-r--r--devel/linuxthreads/pkg-plist14
7 files changed, 168 insertions, 25 deletions
diff --git a/devel/linuxthreads/Makefile b/devel/linuxthreads/Makefile
index 7b423077e28b..590c7361f094 100644
--- a/devel/linuxthreads/Makefile
+++ b/devel/linuxthreads/Makefile
@@ -7,7 +7,7 @@
PORTNAME= linuxthreads
PORTVERSION= 2.2.3
-PORTREVISION= 5
+PORTREVISION= 6
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GNU}
MASTER_SITE_SUBDIR= glibc
@@ -23,6 +23,10 @@ ONLY_FOR_ARCHS= i386
.if ${OSVERSION} < 400015
BROKEN="Requires FreeBSD 4.0 or newer"
.endif
+.if ${OSVERSION} >= 500035
+USING_GCC3=true
+MAKE_ENV+= USING_GCC3=true
+.endif
threads_files := README.FreeBSD clone.S clone.h freebsd-compat.h getgr_r.c \
gethostby_r.c getnetby_r.c getprotoby_r.c getpw_r.c getservby_r.c \
@@ -41,26 +45,68 @@ pre-fetch:
@${ECHO} WITH_CONDWAIT_PATCH
@${ECHO}
.endif
- @if test -f /usr/src/gnu/lib/libgcc/Makefile; then \
+ @if ${TEST} -f /usr/src/gnu/lib/libgcc/Makefile; then \
: ; \
else \
${ECHO_MSG} ">>The linuxthreads port needs source code for libgcc"; \
${ECHO_MSG} ">>Please install FreeBSD source code in /usr/src"; \
false; \
fi
+.if defined(USING_GCC3)
+ @if ${TEST} -f /usr/src/gnu/lib/libstdc++/Makefile; then \
+ : ; \
+ else \
+ ${ECHO_MSG} ">>The linuxthreads port needs source code for libstdc++"; \
+ ${ECHO_MSG} ">>Please install FreeBSD source code in /usr/src"; \
+ false; \
+ fi
+ @if ${TEST} -f /usr/src/gnu/lib/libsupc++/Makefile; then \
+ : ; \
+ else \
+ ${ECHO_MSG} ">>The linuxthreads port needs source code for libsupc++"; \
+ ${ECHO_MSG} ">>Please install FreeBSD source code in /usr/src"; \
+ false; \
+ fi
+.endif
post-extract:
- @mv ${WRKDIR}/linuxthreads ${WRKSRC}
- @mv ${WRKDIR}/linuxthreads_db ${WRKSRC}
+ @${MV} ${WRKDIR}/linuxthreads ${WRKSRC}
+ @${MV} ${WRKDIR}/linuxthreads_db ${WRKSRC}
.for src in lockfile.c no-tsd.c oldsemaphore.c weaks.c \
sysdeps/pthread/semaphore.h
- @mv ${WRKSRC}/$(src) ${WRKSRC}/$(src).unused
+ @${MV} ${WRKSRC}/$(src) ${WRKSRC}/$(src).unused
.endfor
@cd ${FILESDIR} ; \
${CP} -p ${threads_files} ${WRKSRC}/.
@${MKDIR} -p ${WRKSRC}/libgcc_r
- @test -f ${WRKSRC}/libgcc_r/Makefile || \
+ @${TEST} -f ${WRKSRC}/libgcc_r/Makefile || \
${LN} -s ${FILESDIR}/Makefile.libgcc_r ${WRKSRC}/libgcc_r/Makefile
+ @${SED} -e 's/^LIB=[ ]*gcc$$/LIB= lgcc_r/;' \
+ -e 's=$${.CURDIR}=/usr/src/gnu/lib/libgcc=g' \
+ /usr/src/gnu/lib/libgcc/Makefile \
+ > ${WRKSRC}/libgcc_r/Makefile.inc.tmp && \
+ ${MV} ${WRKSRC}/libgcc_r/Makefile.inc.tmp \
+ ${WRKSRC}/libgcc_r/Makefile.inc
+.if defined(USING_GCC3)
+ @${MKDIR} -p ${WRKSRC}/libstdc++
+ @${TEST} -f ${WRKSRC}/libstdc++/Makefile || \
+ ${LN} -s ${FILESDIR}/Makefile.libstdc++ ${WRKSRC}/libstdc++/Makefile
+ @${SED} -e 's/^LIB=[ ]*stdc\+\+$$/LIB= lstdc++/;' \
+ -e 's=$${.CURDIR}=/usr/src/gnu/lib/libstdc++=g' \
+ /usr/src/gnu/lib/libstdc++/Makefile \
+ > ${WRKSRC}/libstdc++/Makefile.inc.tmp && \
+ ${MV} ${WRKSRC}/libstdc++/Makefile.inc.tmp \
+ ${WRKSRC}/libstdc++/Makefile.inc
+ @${MKDIR} -p ${WRKSRC}/libsupc++
+ @${TEST} -f ${WRKSRC}/libsupc++/Makefile || \
+ ${LN} -s ${FILESDIR}/Makefile.libsupc++ ${WRKSRC}/libsupc++/Makefile
+ @${SED} -e 's/^LIB=[ ]*supc\+\+$$/LIB= lsupc++/;' \
+ -e 's=$${.CURDIR}=/usr/src/gnu/lib/libsupc++=g' \
+ /usr/src/gnu/lib/libsupc++/Makefile \
+ > ${WRKSRC}/libsupc++/Makefile.inc.tmp && \
+ ${MV} ${WRKSRC}/libsupc++/Makefile.inc.tmp \
+ ${WRKSRC}/libsupc++/Makefile.inc
+.endif
.if defined(WITH_CONDWAIT_PATCH)
post-patch:
@@ -75,11 +121,23 @@ post-patch:
pre-build:
@cd ${WRKSRC}/libgcc_r ; \
- ${MAKE}
+ ${SETENV} ${MAKE_ENV} ${MAKE}
+.if defined(USING_GCC3)
+ cd ${WRKSRC}/libstdc++ ; \
+ ${SETENV} ${MAKE_ENV} ${MAKE}
+ @cd ${WRKSRC}/libsupc++ ; \
+ ${SETENV} ${MAKE_ENV} ${MAKE}
+.endif
pre-install:
@cd ${WRKSRC}/libgcc_r ; \
- ${MAKE} install
+ ${SETENV} ${MAKE_ENV} ${MAKE} install
+.if defined(USING_GCC3)
+ @cd ${WRKSRC}/libstdc++ ; \
+ ${SETENV} ${MAKE_ENV} ${MAKE} install
+ @cd ${WRKSRC}/libsupc++ ; \
+ ${SETENV} ${MAKE_ENV} ${MAKE} install
+.endif
post-install:
${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m ${PREFIX}/lib
@@ -88,4 +146,23 @@ post-install:
# @sh ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.if defined(NOPROFILE)
+PLIST_SUB= PROFILE:="@comment "
+.else
+PLIST_SUB= PROFILE:=""
+.endif
+.if defined(NOPIC)
+PLIST_SUB+= PIC:="@comment "
+.else
+PLIST_SUB+= PIC:=""
+.endif
+.if defined(USING_GCC3)
+PLIST_SUB+= GCC3ONLY:=""
+PLIST_SUB+= LTHREADSHMAJOR:="3"
+.else
+PLIST_SUB+= GCC3ONLY:="@comment "
+PLIST_SUB+= LTHREADSHMAJOR:="2"
+.endif
+
+
.include <bsd.port.post.mk>
diff --git a/devel/linuxthreads/files/Makefile.libgcc_r b/devel/linuxthreads/files/Makefile.libgcc_r
index 7183cdead4b3..1f6f7f3c9f61 100644
--- a/devel/linuxthreads/files/Makefile.libgcc_r
+++ b/devel/linuxthreads/files/Makefile.libgcc_r
@@ -1,19 +1,18 @@
-# $FreeBSD: /tmp/pcvs/ports/devel/linuxthreads/files/Makefile.libgcc_r,v 1.3 2000-11-06 19:43:33 jasone Exp $
+# $FreeBSD: /tmp/pcvs/ports/devel/linuxthreads/files/Makefile.libgcc_r,v 1.4 2002-06-08 18:27:19 tegge Exp $
-DESTDIR=/usr/local/
-LIBDIR= lib/
+PREFIX?= ${DESTDIR}/usr/local
+LIBDIR= ${PREFIX:S,^${DESTDIR},,}/lib
CFLAGS+=-D_PTHREADS -I../
CFLAGS+=-I../sysdeps/i386 -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux
+CXXFLAGS= ${CXXINCLUDES} ${CFLAGS}
-.include "/usr/src/gnu/lib/libgcc/Makefile"
+installincludes:
+
+.include "Makefile.inc"
#
# Override various things that are set in the main Makefile.
#
-GCCDIR:=$(GCCDIR:T:S/^/\/usr\/src\/contrib\/&/)
-
-LIB= lgcc_r
-
-.PATH: ${GCCDIR}/cp ${GCCDIR}
+.undef SUBDIR
diff --git a/devel/linuxthreads/files/Makefile.libstdc++ b/devel/linuxthreads/files/Makefile.libstdc++
new file mode 100644
index 000000000000..80f0276aea05
--- /dev/null
+++ b/devel/linuxthreads/files/Makefile.libstdc++
@@ -0,0 +1,18 @@
+# $FreeBSD: /tmp/pcvs/ports/devel/linuxthreads/files/Makefile.libstdc++,v 1.1 2002-06-08 18:27:19 tegge Exp $
+
+PREFIX?= ${DESTDIR}/usr/local
+LIBDIR= ${PREFIX:S,^${DESTDIR},,}/lib
+
+CFLAGS+=-D_PTHREADS -I../
+CFLAGS+=-I../sysdeps/i386 -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux
+CXXFLAGS= ${CXXINCLUDES} ${CFLAGS}
+
+installincludes:
+
+.include "Makefile.inc"
+
+#
+# Override various things that are set in the main Makefile.
+#
+
+.undef SUBDIR
diff --git a/devel/linuxthreads/files/Makefile.libsupc++ b/devel/linuxthreads/files/Makefile.libsupc++
new file mode 100644
index 000000000000..ac4ed4aec107
--- /dev/null
+++ b/devel/linuxthreads/files/Makefile.libsupc++
@@ -0,0 +1,18 @@
+# $FreeBSD: /tmp/pcvs/ports/devel/linuxthreads/files/Makefile.libsupc++,v 1.1 2002-06-08 18:27:19 tegge Exp $
+
+PREFIX?= ${DESTDIR}/usr/local
+LIBDIR= ${PREFIX:S,^${DESTDIR},,}/lib
+
+CFLAGS+=-D_PTHREADS -I../
+CFLAGS+=-I../sysdeps/i386 -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux
+CXXFLAGS= ${CXXINCLUDES} ${CFLAGS}
+
+installincludes:
+
+.include "Makefile.inc"
+
+#
+# Override various things that are set in the main Makefile.
+#
+
+.undef SUBDIR
diff --git a/devel/linuxthreads/files/README.FreeBSD b/devel/linuxthreads/files/README.FreeBSD
index 13aa5b376e46..8cd203c2dca7 100644
--- a/devel/linuxthreads/files/README.FreeBSD
+++ b/devel/linuxthreads/files/README.FreeBSD
@@ -72,9 +72,21 @@ set at 20 + 16 * MAXUSERS.
4) Be aware of the following libgcc issue:
+ FreeBSD 4.* (gcc 2.*):
+
__register_frame_info() and __get_eh_info() from libgcc.a are linked
into shared libraries that use exceptions, e.g. libstdc++. Those
functions are not compatible with linuxthreads due to pthread_mutex_t
and pthread_once_t having different sizes and static initializers.
Linking the shared linuxthreads library before any such library causes
the liblgcc_r.a version of those functions to be used.
+
+ FreeBSD 5.* (gcc 3.*):
+
+ __register_frame_info() and __frame_state_for() from libgcc.a are
+ linked into shared libraries that use exceptions, e.g. libstdc++.
+ Those functions are not compatible with linuxthreads due to
+ pthread_mutex_t and pthread_once_t having different sizes and static
+ initializers. Linking the shared linuxthreads library before any such
+ library causes the liblgcc_r.a version of those functions to be used.
+ Use liblstdc++ and liblsupc++.
diff --git a/devel/linuxthreads/files/patch-aa b/devel/linuxthreads/files/patch-aa
index eaa883bb2c85..02ef0dbe362c 100644
--- a/devel/linuxthreads/files/patch-aa
+++ b/devel/linuxthreads/files/patch-aa
@@ -13,11 +13,15 @@ diff -ru ../../work/linuxthreads-2.2.3/Examples/Makefile ./Examples/Makefile
diff -ru ../../work/linuxthreads-2.2.3/Makefile ./Makefile
--- ../../work/linuxthreads-2.2.3/Makefile Wed Apr 25 21:50:59 2001
+++ ./Makefile Thu Jun 7 23:13:52 2001
-@@ -1,128 +1,76 @@
+@@ -1,128 +1,84 @@
-# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
+LIB=lthread
++.if defined(USING_GCC3)
++SHLIB_MAJOR= 3
++.else
+SHLIB_MAJOR= 2
++.endif
+SHLIB_MINOR= 2
+
+.if !defined(MACHINE_ARCH)
@@ -29,10 +33,10 @@ diff -ru ../../work/linuxthreads-2.2.3/Makefile ./Makefile
+.endif
+
+.if !defined(PREFIX)
-+PREFIX = /usr/local
++PREFIX= ${DESTDIR}/usr/local
+.endif
+
-+LIBDIR = ${PREFIX}/lib
++LIBDIR= ${PREFIX:S,^${DESTDIR},,}/lib
+
+CFLAGS +=-g -O2 -Wall
+#CFLAGS +=-g -O0 -Wall -DDEBUG
@@ -60,7 +64,11 @@ diff -ru ../../work/linuxthreads-2.2.3/Makefile ./Makefile
+ specific.c spinlock.c uthread_file.c wraputhread.c wrapsyscall.c \
+ barrier.c localtime.c
+
++.if defined(USING_GCC3)
++SOBJS += libgcc_r/unwind-sjlj.o libgcc_r/unwind-dw2.o libgcc_r/unwind-dw2-fde.o
++.else
+SOBJS += libgcc_r/frame.o libgcc_r/_eh.o
++.endif
+
+beforeinstall:
+ ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 0755 \
@@ -1145,7 +1153,12 @@ diff -ru ../../work/linuxthreads-2.2.3/wrapsyscall.c ./wrapsyscall.c
/* msync(2). */
-@@ -113,40 +118,50 @@
+@@ -109,44 +114,54 @@
+
+ /* open(2). */
+ CANCELABLE_SYSCALL_VA (int, open, (const char *pathname, int flags, ...),
+- (pathname, flags, va_arg (ap, mode_t)), flags)
++ (pathname, flags, va_arg (ap, int)), flags)
strong_alias (open, __open)
diff --git a/devel/linuxthreads/pkg-plist b/devel/linuxthreads/pkg-plist
index 69dab5f05c8c..a916d791d674 100644
--- a/devel/linuxthreads/pkg-plist
+++ b/devel/linuxthreads/pkg-plist
@@ -1,9 +1,15 @@
lib/liblthread.a
-lib/liblthread_p.a
-lib/liblthread.so
-lib/liblthread.so.2.2
+%%PROFILE:%%lib/liblthread_p.a
+%%PIC:%%lib/liblthread.so
+%%PIC:%%lib/liblthread.so.%%LTHREADSHMAJOR:%%.2
lib/liblgcc_r.a
-lib/liblgcc_r_p.a
+%%PROFILE:%%lib/liblgcc_r_p.a
+%%GCC3ONLY:%%lib/liblstdc++.a
+%%GCC3ONLY:%%%%PROFILE:%%lib/liblstdc++_p.a
+%%GCC3ONLY:%%%%PIC:%%lib/liblstdc++.so
+%%GCC3ONLY:%%%%PIC:%%lib/liblstdc++.so.4
+%%GCC3ONLY:%%lib/liblsupc++.a
+%%GCC3ONLY:%%%%PROFILE:%%lib/liblsupc++_p.a
include/pthread/linuxthreads/pthread.h
include/pthread/linuxthreads/semaphore.h
include/pthread/linuxthreads/pt-machine.h