Tweak www/p5-WWW-WebArchive version 0.50_2
[dports.git] / Mk / bsd.gecko.mk
1 #-*- tab-width: 4; -*-
2 # ex:ts=4
3 #
4 # Date created:         12 Nov 2005
5 # Whom:                 Michael Johnson <ahze@FreeBSD.org>
6 #
7 # $FreeBSD$
8 #
9 # 4 column tabs prevent hair loss and tooth decay!
10
11 # bsd.gecko.mk abstracts the selection of gecko-based backends. It allows users
12 # and porters to support any available gecko backend without needing to build
13 # many conditional tests. ${USE_GECKO} is the list of backends that your port
14 # can handle, and ${GECKO} is set by bsd.gecko.mk to be the chosen backend.
15 # Users set ${WITH_GECKO} to the list of gecko backends they want on their
16 # system.
17
18 .if defined(USE_GECKO)
19 .if !defined(_POSTMKINCLUDED) && !defined(Gecko_Pre_Include)
20 Gecko_Pre_Include=      bsd.gecko.mk
21
22 # This file contains some reusable components for mozilla ports. It's of
23 # use primarily to apps from the mozilla project itself (such as Firefox,
24 # Thunderbird, etc.), and probably won't be of use for gecko-based ports
25 # like epiphany, galeon, etc.
26 #
27 # You need to make sure to add USE_GECKO=gecko to for your port can uses
28 # one of these options below.
29 #
30 # Ports can use the following:
31 #
32 # USE_MOZILLA                   By default, it enables every system dependency
33 #                                               listed in '_ALL_DEPENDS'. If your port doesn't
34 #                                               need one of those then you can use '-' like
35 #                                               'USE_MOZILLA= -png -vpx' to subtract the
36 #                                               dependencies. Experimental deps use '+' like
37 #                                               'USE_MOZILLA= +speex +theora'.
38 #
39 # MOZILLA_PLIST_DIRS    List of directories to descend into when installing
40 #                                               and creating the plist
41 #
42 # MOZ_PIS_SCRIPTS               List of scripts residing in ${FILESDIR} to be
43 #                                               filtered through MOZCONFIG_SED and installed along
44 #                                               with our Pluggable Init Scripts (PIS)
45 #
46 # MOZ_SED_ARGS                  sed(1) commands through which MOZ_PIS_SCRIPTS are
47 #                                               filtered. There is a default set defined here, so
48 #                                               you probably want to add to MOZ_SED_ARGS rather
49 #                                               than clobber it
50 #
51 # MOZ_OPTIONS                   configure arguments (added to .mozconfig). If
52 #                                               NOMOZCONFIG is defined, you probably want to set
53 #                                               CONFIGURE_ARGS+=${MOZ_OPTIONS}
54 #
55 # MOZ_MK_OPTIONS                The make(1) arguments (added to .mozconfig). If
56 #                                               NOMOZCONFIG is defined, you probably want to set
57 #                                               MAKE_ARGS+=${MOZ_MK_OPTIONS}
58 #
59 # MOZ_EXPORT                    Environment variables for the build process (added
60 #                                               to .mozconfig). If NOMOZCONFIG is defined, you
61 #                                               probably want to set MAKE_ENV+=${MOZ_EXPORT}
62 #
63 # MOZ_CHROME                    A variable for the --enable-chrome-format= in
64 #                                               CONFIGURE_ARGS. The default is omni.
65 #
66 # MOZ_TOOLKIT                   A variable for the --enable-default-toolkit= in
67 #                                               CONFIGURE_ARGS. The default is cairo-gtk2.
68 #
69 # MOZ_EXTENSIONS                A list of extensions to build
70 #
71 # PORT_MOZCONFIG                Defaults to ${FILESDIR}/mozconfig.in, but can be
72 #                                               set to a generic mozconfig included with the port
73 #
74 # NOMOZCONFIG                   Don't drop a customized .mozconfig into the build
75 #                                               directory. Options will have to be specified in
76 #                                               CONFIGURE_ARGS instead
77 #
78
79 MAINTAINER?=    gecko@FreeBSD.org
80
81 MOZILLA?=       ${PORTNAME}
82 MOZILLA_VER?=   ${PORTVERSION}
83 MOZILLA_BIN?=   ${PORTNAME}-bin
84 MOZILLA_EXEC_NAME?=${MOZILLA}
85 MOZ_RPATH?=     ${MOZILLA}
86 USES+=          cpe gmake iconv localbase perl5 pkgconfig \
87                         python:2.7,build desktop-file-utils
88 CPE_VENDOR?=mozilla
89 USE_PERL5=      build
90 USE_XORG=       x11 xcomposite xdamage xext xfixes xrender xt
91
92 .if ${MOZILLA} != "libxul"
93 BUNDLE_LIBS=    yes
94 .endif
95
96 .if ${MOZILLA_VER:R:R} >= 49
97 USES+=          compiler:c++14-lang
98 CPPFLAGS+=      -D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_MATH_TR1 \
99                         -D_DECLARE_C99_LDBL_MATH # XXX ports/193528
100 .else
101 USES+=          compiler:c++11-lang
102 .endif
103
104 .if ${MOZILLA_VER:R:R} >= 50
105 USE_XORG+=      xcb
106 .endif
107
108 .if ${OPSYS} == FreeBSD && ${OSREL} == 11.1
109 LLD_UNSAFE=     yes
110 .endif
111
112 MOZILLA_SUFX?=  none
113 MOZSRC?=        ${WRKSRC}
114 WRKSRC?=        ${WRKDIR}/mozilla
115 PLISTF?=        ${WRKDIR}/plist_files
116
117 MOZ_OBJDIR?=    ${WRKSRC}/obj-${ARCH:C/amd64/x86_64/}-unknown-${OPSYS:tl}${OSREL}
118
119 MOZ_PIS_DIR?=           lib/${MOZILLA}/init.d
120
121 PORT_MOZCONFIG?=        ${FILESDIR}/mozconfig.in
122 MOZCONFIG?=             ${WRKSRC}/.mozconfig
123 # XXX Not ?= because fmake uses MAKEFILE internally
124 MAKEFILE=               ${WRKSRC}/client.mk
125 MOZILLA_PLIST_DIRS?=    bin lib share/pixmaps share/applications
126 PKGINSTALL?=    ${WRKDIR}/pkg-install
127 PKGDEINSTALL?=  ${WRKDIR}/pkg-deinstall
128 PKGINSTALL_INC?=        ${.CURDIR}/../../www/firefox/files/pkg-install.in
129 PKGDEINSTALL_INC?=      ${.CURDIR}/../../www/firefox/files/pkg-deinstall.in
130
131 MOZ_PKGCONFIG_FILES?=   ${MOZILLA}-gtkmozembed ${MOZILLA}-js \
132                         ${MOZILLA}-xpcom ${MOZILLA}-plugin
133
134 ALL_TARGET?=    build
135
136 MOZ_EXPORT+=    ${CONFIGURE_ENV} \
137                                 PERL="${PERL}"
138 MOZ_OPTIONS+=   --prefix="${PREFIX}"
139 MOZ_MK_OPTIONS+=MOZ_OBJDIR="${MOZ_OBJDIR}"
140
141 LDFLAGS+=               -Wl,--as-needed
142
143 .if ${MOZILLA_VER:R:R} < 55 && ${OPSYS} == FreeBSD && ${OSVERSION} < 1200032
144 # use jemalloc 3.0.0 (4.0 for firefox 43+) API for stats/tuning
145 MOZ_EXPORT+=    MOZ_JEMALLOC4=1
146 .if ${MOZILLA_VER:R:R} >= 48
147 MOZ_OPTIONS+=   --enable-jemalloc=4
148 .elif ${OSVERSION} < 1100079
149 MOZ_OPTIONS+=   --enable-jemalloc
150 .endif # Mozilla >= 48
151 .endif # Mozilla < 55
152
153 # Standard depends
154 _ALL_DEPENDS=   cairo event ffi graphite harfbuzz hunspell icu jpeg nspr nss png pixman soundtouch sqlite vpx
155
156 .if ${PORT_OPTIONS:MINTEGER_SAMPLES}
157 MOZ_EXPORT+=    MOZ_INTEGER_SAMPLES=1
158 _ALL_DEPENDS+=  tremor
159 .else
160 _ALL_DEPENDS+=  vorbis
161 .endif
162
163 .if ! ${PORT_OPTIONS:MBUNDLED_CAIRO}
164 cairo_BUILD_DEPENDS=cairo>=1.12.16_1,2:graphics/cairo
165 cairo_LIB_DEPENDS=      libcairo.so:graphics/cairo
166 cairo_MOZ_OPTIONS=      --enable-system-cairo
167 .endif
168
169 event_LIB_DEPENDS=      libevent.so:devel/libevent
170 event_MOZ_OPTIONS=      --with-system-libevent
171
172 ffi_LIB_DEPENDS=        libffi.so:devel/libffi
173 ffi_MOZ_OPTIONS=        --enable-system-ffi
174
175 .if exists(${FILESDIR}/patch-bug847568)
176 graphite_LIB_DEPENDS=   libgraphite2.so:graphics/graphite2
177 graphite_MOZ_OPTIONS=   --with-system-graphite2
178
179 harfbuzz_LIB_DEPENDS=   libharfbuzz.so:print/harfbuzz
180 harfbuzz_MOZ_OPTIONS=   --with-system-harfbuzz
181 .endif
182
183 hunspell_LIB_DEPENDS=   libhunspell-1.6.so:textproc/hunspell
184 hunspell_MOZ_OPTIONS=   --enable-system-hunspell
185
186 icu_LIB_DEPENDS=                libicui18n.so:devel/icu
187 icu_MOZ_OPTIONS=                --with-system-icu --with-intl-api
188
189 -jpeg_BUILD_DEPENDS=yasm:devel/yasm
190 # XXX Remove files/patch-ijg-libjpeg once -turbo is default
191 jpeg_USES=              jpeg
192 jpeg_MOZ_OPTIONS=       --with-system-jpeg=${LOCALBASE}
193
194 nspr_LIB_DEPENDS=       libnspr4.so:devel/nspr
195 nspr_MOZ_OPTIONS=       --with-system-nspr
196
197 nss_LIB_DEPENDS=        libnss3.so:security/nss
198 nss_MOZ_OPTIONS=        --with-system-nss
199
200 pixman_LIB_DEPENDS=     libpixman-1.so:x11/pixman
201 pixman_MOZ_OPTIONS=     --enable-system-pixman
202
203 png_LIB_DEPENDS=        libpng.so:graphics/png
204 png_MOZ_OPTIONS=        --with-system-png=${LOCALBASE}
205
206 .if exists(${FILESDIR}/patch-z-bug517422)
207 soundtouch_LIB_DEPENDS= libSoundTouch.so:audio/soundtouch
208 soundtouch_MOZ_OPTIONS= --with-system-soundtouch
209 .endif
210
211 sqlite_LIB_DEPENDS=     libsqlite3.so:databases/sqlite3
212 sqlite_MOZ_OPTIONS=     --enable-system-sqlite
213
214 .if exists(${FILESDIR}/patch-z-bug517422)
215 # XXX disabled: update to 1.2.x or review backported fixes
216 theora_LIB_DEPENDS=     libtheora.so:multimedia/libtheora
217 theora_MOZ_OPTIONS=     --with-system-theora
218
219 tremor_LIB_DEPENDS=     libogg.so:audio/libogg libvorbisidec.so:audio/libtremor
220 tremor_MOZ_OPTIONS=     --with-system-tremor --with-system-ogg
221
222 vorbis_LIB_DEPENDS=     libogg.so:audio/libogg libvorbis.so:audio/libvorbis
223 vorbis_MOZ_OPTIONS=     --with-system-vorbis --with-system-ogg
224 .endif
225
226 -vpx_BUILD_DEPENDS=     yasm:devel/yasm
227 vpx_LIB_DEPENDS=        libvpx.so:multimedia/libvpx
228 vpx_MOZ_OPTIONS=        --with-system-libvpx
229
230 .for use in ${USE_MOZILLA}
231 ${use:S/-/_WITHOUT_/}=  ${TRUE}
232 .endfor
233
234 LIB_DEPENDS+=   libfontconfig.so:x11-fonts/fontconfig \
235                 libfreetype.so:print/freetype2
236
237 .for dep in ${_ALL_DEPENDS} ${USE_MOZILLA:M+*:S/+//}
238 .if !defined(_WITHOUT_${dep})
239 BUILD_DEPENDS+= ${${dep}_BUILD_DEPENDS}
240 LIB_DEPENDS+=   ${${dep}_LIB_DEPENDS}
241 RUN_DEPENDS+=   ${${dep}_RUN_DEPENDS}
242 USES+=          ${${dep}_USES}
243 MOZ_OPTIONS+=   ${${dep}_MOZ_OPTIONS}
244 .else
245 BUILD_DEPENDS+= ${-${dep}_BUILD_DEPENDS}
246 .endif
247 .endfor
248
249 # Standard options
250 MOZ_CHROME?=    omni
251 MOZ_TOOLKIT?=   cairo-gtk3
252 MOZ_CHANNEL?=   ${PKGNAMESUFFIX:Urelease:S/^-//}
253 MOZ_OPTIONS+=   \
254                 --enable-chrome-format=${MOZ_CHROME} \
255                 --enable-default-toolkit=${MOZ_TOOLKIT} \
256                 --enable-update-channel=${MOZ_CHANNEL} \
257                 --disable-updater \
258                 --enable-pie \
259                 --with-pthreads
260 # Configure options for install
261 .if !defined(MOZ_EXTENSIONS)
262 MOZ_OPTIONS+=   --enable-extensions=default
263 .else
264 MOZ_OPTIONS+=   --enable-extensions=${MOZ_EXTENSIONS}
265 .endif
266 # others
267 MOZ_OPTIONS+=   --with-system-zlib              \
268                 --with-system-bz2
269
270 # API keys from www/chromium 
271 # http://www.chromium.org/developers/how-tos/api-keys
272 # Note: these are for FreeBSD use ONLY. For your own distribution,
273 # please get your own set of keys.
274 MOZ_EXPORT+=    MOZ_GOOGLE_API_KEY=AIzaSyBsp9n41JLW8jCokwn7vhoaMejDFRd1mp8
275
276 .if ${PORT_OPTIONS:MGTK2}
277 MOZ_TOOLKIT=    cairo-gtk2
278 .endif
279
280 .if ${MOZ_TOOLKIT:Mcairo-gtk3}
281 BUILD_DEPENDS+= gtk3>=3.14.6:x11-toolkits/gtk30
282 USE_GNOME+=     gdkpixbuf2 gtk20 gtk30
283 .else # gtk2, cairo-gtk2
284 USE_GNOME+=     gdkpixbuf2 gtk20
285 .endif
286
287 .if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
288 CFLAGS+=                -O3
289 MOZ_EXPORT+=    MOZ_OPTIMIZE_FLAGS="${CFLAGS:M-O*}"
290 MOZ_OPTIONS+=   --enable-optimize
291 .else
292 MOZ_OPTIONS+=   --disable-optimize
293 .endif
294
295 .if ${PORT_OPTIONS:MCANBERRA}
296 RUN_DEPENDS+=   libcanberra>0:audio/libcanberra
297 .endif
298
299 .if ${PORT_OPTIONS:MDBUS}
300 BUILD_DEPENDS+= libnotify>0:devel/libnotify
301 LIB_DEPENDS+=   libdbus-1.so:devel/dbus \
302                                 libdbus-glib-1.so:devel/dbus-glib \
303                                 libstartup-notification-1.so:x11/startup-notification
304 MOZ_OPTIONS+=   --enable-startup-notification
305 .else
306 MOZ_OPTIONS+=   --disable-dbus
307 .endif
308
309 .if ${PORT_OPTIONS:MFFMPEG}
310 # dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
311 RUN_DEPENDS+=   ffmpeg>=0.8,1:multimedia/ffmpeg
312 .endif
313
314 .if ${MOZILLA_VER:R:R} < 46
315 MOZ_OPTIONS+=   --disable-gstreamer
316 .endif
317
318 .if ${PORT_OPTIONS:MGCONF}
319 BUILD_DEPENDS+= ${gconf2_DETECT}:${gconf2_LIB_DEPENDS:C/.*://}
320 USE_GNOME+=             gconf2:build
321 MOZ_OPTIONS+=   --enable-gconf
322 .else
323 MOZ_OPTIONS+=   --disable-gconf
324 .endif
325
326 .if ${MOZILLA_VER:R:R} < 55
327 .if ${PORT_OPTIONS:MGNOMEUI}
328 BUILD_DEPENDS+= ${libgnomeui_DETECT}:${libgnomeui_LIB_DEPENDS:C/.*://}
329 USE_GNOME+=             libgnomeui:build
330 MOZ_OPTIONS+=   --enable-gnomeui
331 .else
332 MOZ_OPTIONS+=   --disable-gnomeui
333 .endif
334 .endif # Mozilla < 55
335
336 .if ${PORT_OPTIONS:MLIBPROXY}
337 LIB_DEPENDS+=   libproxy.so:net/libproxy
338 MOZ_OPTIONS+=   --enable-libproxy
339 .else
340 MOZ_OPTIONS+=   --disable-libproxy
341 .endif
342
343 .if ${PORT_OPTIONS:MPGO}
344 USES:=          compiler:gcc-c++11-lib ${USES:Ncompiler*c++11*}
345 USE_DISPLAY=yes
346
347 ALL_TARGET=     profiledbuild
348 MOZ_EXPORT+=MOZ_OPTIMIZE_FLAGS="-Os" MOZ_PGO_OPTIMIZE_FLAGS="${CFLAGS:M-O*}"
349 .endif
350
351 .if ${PORT_OPTIONS:MALSA}
352 LIB_DEPENDS+=   libasound.so:audio/alsa-lib
353 RUN_DEPENDS+=   ${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:audio/alsa-plugins
354 RUN_DEPENDS+=   alsa-lib>=1.1.1_1:audio/alsa-lib
355 MOZ_OPTIONS+=   --enable-alsa
356 .endif
357
358 .if ${PORT_OPTIONS:MJACK}
359 BUILD_DEPENDS+= ${LOCALBASE}/include/jack/jack.h:audio/jack
360 MOZ_OPTIONS+=   --enable-jack
361 .endif
362
363 .if ${PORT_OPTIONS:MPULSEAUDIO}
364 BUILD_DEPENDS+= ${LOCALBASE}/include/pulse/pulseaudio.h:audio/pulseaudio
365 MOZ_OPTIONS+=   --enable-pulseaudio
366 .else
367 MOZ_OPTIONS+=   --disable-pulseaudio
368 .endif
369
370 .if ${PORT_OPTIONS:MSNDIO}
371 LIB_DEPENDS+=   libsndio.so:audio/sndio
372 post-patch-SNDIO-on:
373         @${REINPLACE_CMD} -e 's|OpenBSD|${OPSYS}|g' \
374                 ${MOZSRC}/media/libcubeb/src/moz.build \
375                 ${MOZSRC}/toolkit/library/moz.build
376 . for tests in tests gtest
377         @if [ -f "${MOZSRC}/media/libcubeb/${tests}/moz.build" ]; then \
378                 ${REINPLACE_CMD} -e 's|OpenBSD|${OPSYS}|g' \
379                          ${MOZSRC}/media/libcubeb/${tests}/moz.build \
380         ; fi
381 . endfor
382         @${REINPLACE_CMD} -e 's|OS==\"openbsd\"|OS==\"${OPSYS:tl}\"|g' \
383                 ${MOZSRC}/media/webrtc/trunk/webrtc/build/common.gypi
384         @${ECHO} "OS_LIBS += ['sndio']" >> \
385                 ${MOZSRC}/media/webrtc/signaling/test/common.build
386 .endif
387
388 .if ${PORT_OPTIONS:MRUST} || ${MOZILLA_VER:R:R} >= 54
389 BUILD_DEPENDS+= rust>=1.19.0_2:${RUST_PORT}
390 RUST_PORT?=             lang/rust
391 . if ${MOZILLA_VER:R:R} < 54
392 MOZ_OPTIONS+=   --enable-rust
393 . endif
394 .else
395 MOZ_OPTIONS+=   --disable-rust
396 .endif
397
398 .if ${PORT_OPTIONS:MDEBUG}
399 MOZ_OPTIONS+=   --enable-debug --disable-release
400 STRIP=  # ports/184285
401 .else
402 MOZ_OPTIONS+=   --disable-debug --disable-debug-symbols --enable-release
403 . if ${MOZILLA_VER:R:R} >= 56
404 MOZ_OPTIONS+=   --enable-rust-simd
405 . endif
406 .endif
407
408 .if ${PORT_OPTIONS:MDTRACE}
409 MOZ_OPTIONS+=   --enable-dtrace \
410                 --disable-gold
411 . if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100061
412 LIBS+=                  -lelf
413 . endif
414 STRIP=
415 LLD_UNSAFE=             yes
416 .else
417 MOZ_OPTIONS+=   --disable-dtrace
418 .endif
419
420 .if ${PORT_OPTIONS:MPROFILE}
421 MOZ_OPTIONS+=   --enable-profiling
422 STRIP=
423 .else
424 MOZ_OPTIONS+=   --disable-profiling
425 .endif
426
427 .if ${PORT_OPTIONS:MTEST}
428 USE_XORG+=              xscrnsaver
429 MOZ_OPTIONS+=   --enable-tests
430 .else
431 MOZ_OPTIONS+=   --disable-tests
432 .endif
433
434 .if !defined(STRIP) || ${STRIP} == ""
435 MOZ_OPTIONS+=   --disable-strip --disable-install-strip
436 .else
437 MOZ_OPTIONS+=   --enable-strip --enable-install-strip
438 .endif
439
440 # _MAKE_JOBS is only available after bsd.port.post.mk, thus cannot be
441 # used in .mozconfig. And client.mk automatically uses -jN where N
442 # is what multiprocessing.cpu_count() returns.
443 .if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE)
444 MAKE_JOBS_NUMBER=       1
445 .endif
446 .if defined(MAKE_JOBS_NUMBER)
447 MOZ_MAKE_FLAGS+=-j${MAKE_JOBS_NUMBER}
448 .endif
449
450 .if defined(MOZ_MAKE_FLAGS)
451 MOZ_MK_OPTIONS+=MOZ_MAKE_FLAGS="${MOZ_MAKE_FLAGS}"
452 .endif
453
454 MOZ_SED_ARGS+=  -e's|@CPPFLAGS@|${CPPFLAGS}|g'          \
455                 -e 's|@CFLAGS@|${CFLAGS}|g'             \
456                 -e 's|@LDFLAGS@|${LDFLAGS}|g'           \
457                 -e 's|@LIBS@|${LIBS}|g'                 \
458                 -e 's|@LOCALBASE@|${LOCALBASE}|g'       \
459                 -e 's|@PERL@|${PERL}|g'                 \
460                 -e 's|@MOZDIR@|${PREFIX}/lib/${MOZILLA}|g'      \
461                 -e 's|%%PREFIX%%|${PREFIX}|g'           \
462                 -e 's|%%CFLAGS%%|${CFLAGS}|g'           \
463                 -e 's|%%LDFLAGS%%|${LDFLAGS}|g'         \
464                 -e 's|%%LIBS%%|${LIBS}|g'               \
465                 -e 's|%%LOCALBASE%%|${LOCALBASE}|g'     \
466                 -e 's|%%PERL%%|${PERL}|g'               \
467                 -e 's|%%MOZILLA%%|${MOZILLA}|g'         \
468                 -e 's|%%MOZILLA_BIN%%|${MOZILLA_BIN}|g' \
469                 -e 's|%%MOZDIR%%|${PREFIX}/lib/${MOZILLA}|g'
470 MOZCONFIG_SED?= ${SED} ${MOZ_SED_ARGS}
471
472 .if ${ARCH} == amd64
473 . if ${USE_MOZILLA:M-nss}
474 USE_BINUTILS=   # intel-gcm.s
475 CFLAGS+=        -B${LOCALBASE}/bin
476 LDFLAGS+=       -B${LOCALBASE}/bin
477 . endif
478 .elif ${ARCH:Mpowerpc*}
479 . if ${ARCH} == "powerpc64"
480 MOZ_EXPORT+=    UNAME_m="${ARCH}"
481 CFLAGS+=        -mminimal-toc
482 . endif
483 .elif ${ARCH} == "sparc64"
484 # Work around miscompilation/mislinkage of the sCanonicalVTable hacks.
485 MOZ_OPTIONS+=   --disable-v1-string-abi
486 .endif
487
488 .else # bsd.port.post.mk
489
490 pre-extract: gecko-pre-extract
491
492 gecko-pre-extract:
493 .if ${PORT_OPTIONS:MPGO}
494         @${ECHO} "*****************************************************************"
495         @${ECHO} "**************************** attention **************************"
496         @${ECHO} "*****************************************************************"
497         @${ECHO} "To build ${MOZILLA} with PGO support you need a running X server and"
498         @${ECHO} "   build this port with an user who could access the X server!   "
499         @${ECHO} ""
500         @${ECHO} "During the build a ${MOZILLA} instance will start and run some test."
501         @${ECHO} "      Do not interrupt or close ${MOZILLA} during these tests!       "
502         @${ECHO} "*****************************************************************"
503         @sleep 10
504 .endif
505
506 post-patch: gecko-post-patch gecko-moz-pis-patch
507
508 gecko-post-patch:
509 .if exists(${PKGINSTALL_INC})
510         @${MOZCONFIG_SED} < ${PKGINSTALL_INC} > ${PKGINSTALL}
511 .endif
512 .if exists(${PKGDEINSTALL_INC})
513         @${MOZCONFIG_SED} < ${PKGDEINSTALL_INC} > ${PKGDEINSTALL}
514 .endif
515         @${RM} ${MOZCONFIG}
516 .if !defined(NOMOZCONFIG)
517         @if [ -e ${PORT_MOZCONFIG} ] ; then \
518                 ${MOZCONFIG_SED} < ${PORT_MOZCONFIG} >> ${MOZCONFIG} ; \
519         fi
520 .for arg in ${MOZ_OPTIONS}
521         @${ECHO_CMD} ac_add_options ${arg:Q} >> ${MOZCONFIG}
522 .endfor
523 .for arg in ${MOZ_MK_OPTIONS}
524         @${ECHO_CMD} mk_add_options ${arg:Q} >> ${MOZCONFIG}
525 .endfor
526 .for var in ${MOZ_EXPORT}
527         @${ECHO_CMD} export ${var:Q} >> ${MOZCONFIG}
528 .endfor
529 .endif # .if !defined(NOMOZCONFIG)
530 .if exists(${MOZSRC}/build/unix/mozilla-config.in)
531         @${REINPLACE_CMD} -e  's/%{idldir}/%idldir%/g ; \
532                 s|"%FULL_NSPR_CFLAGS%"|`nspr-config --cflags`|g ; \
533                 s|"%FULL_NSPR_LIBS%"|`nspr-config --libs`|g' \
534                         ${MOZSRC}/build/unix/mozilla-config.in
535 .endif
536 .if ${USE_MOZILLA:M-nspr}
537         @${ECHO_MSG} "===>  Applying NSPR patches"
538         @for i in ${.CURDIR}/../../devel/nspr/files/patch-*; do \
539                 ${PATCH} ${PATCH_ARGS} -d ${MOZSRC}/nsprpub < $$i; \
540         done
541 .endif
542 .if ${USE_MOZILLA:M-nss}
543         @${ECHO_MSG} "===>  Applying NSS patches"
544         @for i in ${.CURDIR}/../../security/nss/files/patch-*; do \
545                 ${PATCH} ${PATCH_ARGS} -d ${MOZSRC}/security/nss < $$i; \
546         done
547 .endif
548         @for f in \
549                         ${WRKSRC}/directory/c-sdk/config/FreeBSD.mk \
550                         ${WRKSRC}/directory/c-sdk/configure \
551                         ${MOZSRC}/security/coreconf/FreeBSD.mk \
552                         ${MOZSRC}/js/src/Makefile.in \
553                         ${MOZSRC}/js/src/configure \
554                         ${MOZSRC}/configure \
555                         ${WRKSRC}/configure; do \
556                 if [ -f $$f ] ; then \
557                         ${REINPLACE_CMD} -Ee 's|-lc_r|-pthread|g ; \
558                                 s|-l?pthread|-pthread|g ; \
559                                 s|echo aout|echo elf|g ; \
560                                 s|/usr/X11R6|${LOCALBASE}|g' \
561                                 $$f; \
562                 fi; \
563         done
564         @if [ -f ${WRKSRC}/config/baseconfig.mk ] ; then \
565                 ${REINPLACE_CMD} -e 's|%%MOZILLA%%|${MOZILLA}|g' \
566                         ${WRKSRC}/config/baseconfig.mk; \
567         fi
568         @${REINPLACE_CMD} -e 's|%%MOZILLA%%|${MOZILLA}|g' \
569                         ${MOZSRC}/config/baseconfig.mk
570         @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g ; \
571                 s|%%LOCALBASE%%|${LOCALBASE}|g' \
572                         ${MOZSRC}/build/unix/run-mozilla.sh
573         @${REINPLACE_CMD} -e 's|/usr/local/netscape|${LOCALBASE}|g ; \
574                 s|/usr/local/lib/netscape|${LOCALBASE}/lib|g' \
575                 ${MOZSRC}/xpcom/io/SpecialSystemDirectory.cpp
576         @${REINPLACE_CMD} -e 's|/etc|${PREFIX}&|g' \
577                 ${MOZSRC}/xpcom/build/nsXPCOMPrivate.h
578         @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
579                 -e 's|mozilla/plugins|browser_plugins|g' \
580                 -e 's|share/mozilla/extensions|lib/xpi|g' \
581                 ${MOZSRC}/xpcom/io/nsAppFileLocationProvider.cpp \
582                 ${MOZSRC}/toolkit/xre/nsXREDirProvider.cpp
583         @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
584                 ${MOZSRC}/extensions/spellcheck/hunspell/*/mozHunspell.cpp
585
586 # handles mozilla pis scripts.
587 gecko-moz-pis-patch:
588 .for moz in ${MOZ_PIS_SCRIPTS}
589         @${MOZCONFIG_SED} < ${FILESDIR}/${moz} > ${WRKDIR}/${moz}
590 .endfor
591
592 do-configure: gecko-do-configure
593
594 gecko-do-configure:
595                 @(if ! ${CONFIGURE_ENV} ${DO_MAKE_BUILD} configure; then \
596                          ${ECHO_MSG} "===>  Script \"${CONFIGURE_SCRIPT}\" failed unexpectedly."; \
597                          (${ECHO_CMD} ${CONFIGURE_FAIL_MESSAGE}) | ${FMT_80} ; \
598                          ${FALSE}; \
599                 fi)
600
601 pre-install: gecko-moz-pis-pre-install
602 post-install-script: gecko-create-plist
603
604 gecko-create-plist:
605 # Create the plist
606         ${RM} ${PLISTF}
607 .for dir in ${MOZILLA_PLIST_DIRS}
608         @cd ${STAGEDIR}${PREFIX}/${dir} && ${FIND} -H -s * ! -type d | \
609                 ${SED} -e 's|^|${dir}/|' >> ${PLISTF}
610 .endfor
611         ${CAT} ${PLISTF} | ${SORT} >> ${TMPPLIST}
612
613 gecko-moz-pis-pre-install:
614 .if defined(MOZ_PIS_SCRIPTS)
615         ${MKDIR} ${STAGEDIR}${PREFIX}/${MOZ_PIS_DIR}
616 .for moz in ${MOZ_PIS_SCRIPTS}
617         ${INSTALL_SCRIPT} ${WRKDIR}/${moz} ${STAGEDIR}${PREFIX}/${MOZ_PIS_DIR}
618 .endfor
619 .endif
620
621 .endif
622 .endif
623 # HERE THERE BE TACOS -- adamw