blob: 1a9e5a51182eada9e545bcaf03eb4e06713c3231 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# New ports collection makefile for: linuxthreads
# Date created: 14 Jan 1999
# Whom: Richard Seaman, Jr. <dick@tar.com>
#
# $FreeBSD$
#
PORTNAME= linuxthreads
PORTVERSION= 2.2.3
PORTREVISION= 15
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GNU}
MASTER_SITE_SUBDIR= glibc
DISTNAME= glibc-linuxthreads-${PORTVERSION}
MAINTAINER= tegge@freebsd.org
COMMENT= POSIX pthreads implementation using rfork to generate kernel threads
.if defined(LINUXTHREADS_WRAP_API)
USE_PERL5_BUILD=true
.endif
.include <bsd.port.pre.mk>
# This port only works on i386 right now.
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
.if defined(INSTALL_LIBLTHREAD_PIC_ARCHIVE)
MAKE_ENV+= INSTALL_LIBLTHREAD_PIC_ARCHIVE=yes
.endif
.if defined(LINUXTHREADS_DETECT_UNSAFE_EXIT)
MAKE_ENV+= LINUXTHREADS_DETECT_UNSAFE_EXIT=yes
.endif
.if defined(LINUXTHREADS_WRAP_API)
MAKE_ENV+= LINUXTHREADS_WRAP_API=yes
MAKE_ENV+= LINUXTHREADS_WRAP_LD="sh ${FILESDIR}/ldwrap"
.endif
.if defined(LINUXTHREADS_NO_POSIX_PRIORITY_SCHEDULING)
MAKE_ENV+= LINUXTHREADS_NO_POSIX_PRIORITY_SCHEDULING=yes
.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 \
lclone.c libc_calls.c libc_thread.c sched.c uthread_file.c \
wraputhread.c localtime.c getlogin.c telldir.c ttyname.c
WRKSRC= ${WRKDIR}/${PKGNAME}
SRC_BASE= /usr/src
LIBSRC_BASE= ${SRC_BASE}/lib
pre-fetch:
.if !defined(WITH_CONDWAIT_PATCH)
@${ECHO}
@${ECHO} You can use an experimental patch to reduce the number of
@${ECHO} condition variable triggered context switches by defining
@${ECHO} WITH_CONDWAIT_PATCH
@${ECHO}
.endif
.if !defined(LINUXTHREADS_DETECT_UNSAFE_EXIT)
@${ECHO}
@${ECHO} "Some unsafe calls to exit() can be detected by defining"
@${ECHO} "LINUXTHREADS_DETECT_UNSAFE_EXIT, see files/README.FreeBSD"
@${ECHO} "for more info."
@${ECHO}
.endif
.if !defined(LINUXTHREADS_WRAP_API)
@${ECHO}
@${ECHO} "Some conflicts with native threads can be avoided by defining"
@${ECHO} "LINUXTHREADS_WRAP_API, see files/README.FreeBSD"
@${ECHO} "for more info."
@${ECHO}
.endif
.if !defined(LINUXTHREADS_NO_POSIX_PRIORITY_SCHEDULING)
@${ECHO}
@${ECHO} "Use of POSIX priority scheduling can be turned off by"
@${ECHO} "defining LINUXTHREADS_NO_POSIX_PRIORITY_SCHEDULING,"
@${ECHO} "see files/README.FreeBSD for more info."
@${ECHO}
.endif
@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}
.for src in lockfile.c no-tsd.c oldsemaphore.c weaks.c \
sysdeps/pthread/semaphore.h
@${MV} ${WRKSRC}/$(src) ${WRKSRC}/$(src).unused
.endfor
@cd ${FILESDIR} ; \
${CP} -p ${threads_files} ${WRKSRC}/.
@${SED} -f ${FILESDIR}/strptime.sed \
/usr/src/lib/libc/stdtime/strptime.c \
> ${WRKSRC}/strptime.c
@${MKDIR} ${WRKSRC}/libgcc_r
@${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} ${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} ${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) || defined(LINUXTHREADS_WRAP_API)
post-patch:
.if defined(WITH_CONDWAIT_PATCH)
@${ECHO_MSG} "===> Applying experimental patch condwait-patch"
@if ${PATCH} ${PATCH_ARGS} < ${PATCHDIR}/condwait-patch; then \
${ECHO_MSG} "===> Patch condwait-patch applied successfully"; \
else \
${ECHO_MSG} ">>Patch condwait-patch failed to apply cleanly"; \
${FALSE}; \
fi
.endif
.if defined(LINUXTHREADS_WRAP_API)
perl -pi -e '$$func=$$1 if m/^extern\s+\S+\s+\*?(\S+)\s+\(/; $$alias="#ifdef COMPILING_WRAPUTHREAD\n\t__attribute__((weak, alias(\"_$$func\")))\n#endif\n"; $$wrap="#ifndef COMPILING_LINUXTHREADS\n\t__asm__(\"linuxthreads_$$func\")\n#endif\n"; $$alias="" if ( $$func =~ m/^(pthread_spin|_pthread_cleanup|pthread_rwlockattr_[gs]etkind_np|pthread_kill_other_threads_np)/ ); s=__THROW=\n$$wrap$$alias\t__THROW= unless m/^#/;' ${WRKSRC}/sysdeps/pthread/pthread.h ${WRKSRC}/sysdeps/unix/sysv/linux/bits/sigthread.h
.endif
.endif
pre-build:
@cd ${WRKSRC}/libgcc_r ; \
${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:
${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 0755 ${PREFIX}/lib
@cd ${WRKSRC}/libgcc_r ; \
${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
${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m /usr/lib
${CAT} ${PKGMESSAGE}
# @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(INSTALL_PIC_ARCHIVE)
PLIST_SUB+= PICARCHIVE:=""
.else
PLIST_SUB+= PICARCHIVE:="@comment "
.endif
.if defined(INSTALL_PIC_ARCHIVE) || ${OSVERSION} >= 501101
PLIST_SUB+= LIBLGCC_R_PICARCHIVE:=""
.else
PLIST_SUB+= LIBLGCC_R_PICARCHIVE:="@comment "
.endif
.if defined(INSTALL_PIC_ARCHIVE) || defined(INSTALL_LIBLTHREAD_PIC_ARCHIVE)
PLIST_SUB+= LIBLTHREADPICARCHIVE:=""
.else
PLIST_SUB+= LIBLTHREADPICARCHIVE:="@comment "
.endif
.if defined(USING_GCC3)
PLIST_SUB+= GCC3ONLY:=""
.if defined(LINUXTHREADS_WRAP_API)
PLIST_SUB+= LTHREADSHMAJOR:="5"
.else
PLIST_SUB+= LTHREADSHMAJOR:="3"
.endif
.else
PLIST_SUB+= GCC3ONLY:="@comment "
.if defined(LINUXTHREADS_WRAP_API)
PLIST_SUB+= LTHREADSHMAJOR:="4"
.else
PLIST_SUB+= LTHREADSHMAJOR:="2"
.endif
.endif
.include <bsd.port.post.mk>
|