Import sysutils/signon-ui version 0.17
[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 # PORT_MOZCONFIG                Defaults to ${FILESDIR}/mozconfig.in, but can be
70 #                                               set to a generic mozconfig included with the port
71 #
72 # NOMOZCONFIG                   Don't drop a customized .mozconfig into the build
73 #                                               directory. Options will have to be specified in
74 #                                               CONFIGURE_ARGS instead
75 #
76
77 MAINTAINER?=    gecko@FreeBSD.org
78
79 MOZILLA?=       ${PORTNAME}
80 MOZILLA_VER?=   ${PORTVERSION}
81 MOZILLA_BIN?=   ${PORTNAME}-bin
82 MOZILLA_EXEC_NAME?=${MOZILLA}
83 MOZ_RPATH?=     ${MOZILLA}
84 USES+=          cpe gmake iconv localbase perl5 pkgconfig \
85                         python:2.7,build desktop-file-utils
86 CPE_VENDOR?=mozilla
87 USE_PERL5=      build
88 USE_XORG=       x11 xcomposite xdamage xext xfixes xrender xt
89 HAS_CONFIGURE=  yes
90 CONFIGURE_OUTSOURCE=    yes
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 ${MOZILLA_VER:R:R} >= 56
109 MESA_LLVM_VER?= 50
110 BUILD_DEPENDS+= llvm${MESA_LLVM_VER}>0:devel/llvm${MESA_LLVM_VER}
111 MOZ_EXPORT+=    LLVM_CONFIG=llvm-config${MESA_LLVM_VER}
112 .endif
113
114 .if ${OPSYS} == FreeBSD && ${OSREL} == 11.1
115 LLD_UNSAFE=     yes
116 .endif
117
118 MOZILLA_SUFX?=  none
119 MOZSRC?=        ${WRKSRC}
120 PLISTF?=        ${WRKDIR}/plist_files
121
122 MOZ_PIS_DIR?=           lib/${MOZILLA}/init.d
123
124 PORT_MOZCONFIG?=        ${FILESDIR}/mozconfig.in
125 MOZCONFIG?=             ${WRKSRC}/.mozconfig
126 MOZILLA_PLIST_DIRS?=    bin lib share/pixmaps share/applications
127 PKGINSTALL?=    ${WRKDIR}/pkg-install
128 PKGDEINSTALL?=  ${WRKDIR}/pkg-deinstall
129 PKGINSTALL_INC?=        ${.CURDIR}/../../www/firefox/files/pkg-install.in
130 PKGDEINSTALL_INC?=      ${.CURDIR}/../../www/firefox/files/pkg-deinstall.in
131
132 MOZ_PKGCONFIG_FILES?=   ${MOZILLA}-gtkmozembed ${MOZILLA}-js \
133                         ${MOZILLA}-xpcom ${MOZILLA}-plugin
134
135 MOZ_EXPORT+=    ${CONFIGURE_ENV} \
136                                 RUSTFLAGS="${RUSTFLAGS}" \
137                                 PERL="${PERL}"
138 MOZ_OPTIONS+=   --prefix="${PREFIX}"
139 MOZ_MK_OPTIONS+=MOZ_OBJDIR="${BUILD_WRKSRC}"
140
141 LDFLAGS+=               -Wl,--as-needed
142
143 # Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk
144 .if ${ARCH} == amd64 || ${ARCH} == i386
145 RUSTFLAGS+=     ${CFLAGS:M-march=*:S/-march=/-C target-cpu=/}
146 .else
147 RUSTFLAGS+=     ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/}
148 .endif
149
150 .if ${MOZILLA_VER:R:R} < 55 && ${OPSYS} == FreeBSD && ${OSVERSION} < 1200032
151 # use jemalloc 3.0.0 (4.0 for firefox 43+) API for stats/tuning
152 MOZ_EXPORT+=    MOZ_JEMALLOC4=1
153 .if ${MOZILLA_VER:R:R} >= 48
154 MOZ_OPTIONS+=   --enable-jemalloc=4
155 .elif ${OSVERSION} < 1100079
156 MOZ_OPTIONS+=   --enable-jemalloc
157 .endif # Mozilla >= 48
158 .endif # Mozilla < 55
159
160 # Standard depends
161 _ALL_DEPENDS=   cairo event ffi graphite harfbuzz hunspell icu jpeg nspr nss png pixman soundtouch sqlite vpx
162
163 .if ${PORT_OPTIONS:MINTEGER_SAMPLES}
164 MOZ_EXPORT+=    MOZ_INTEGER_SAMPLES=1
165 _ALL_DEPENDS+=  tremor
166 .else
167 _ALL_DEPENDS+=  vorbis
168 .endif
169
170 .if ! ${PORT_OPTIONS:MBUNDLED_CAIRO}
171 cairo_BUILD_DEPENDS=cairo>=1.12.16_1,2:graphics/cairo
172 cairo_LIB_DEPENDS=      libcairo.so:graphics/cairo
173 cairo_MOZ_OPTIONS=      --enable-system-cairo
174 .endif
175
176 event_LIB_DEPENDS=      libevent.so:devel/libevent
177 event_MOZ_OPTIONS=      --with-system-libevent
178
179 ffi_LIB_DEPENDS=        libffi.so:devel/libffi
180 ffi_MOZ_OPTIONS=        --enable-system-ffi
181
182 .if exists(${FILESDIR}/patch-bug847568)
183 graphite_LIB_DEPENDS=   libgraphite2.so:graphics/graphite2
184 graphite_MOZ_OPTIONS=   --with-system-graphite2
185
186 harfbuzz_LIB_DEPENDS=   libharfbuzz.so:print/harfbuzz
187 harfbuzz_MOZ_OPTIONS=   --with-system-harfbuzz
188 .endif
189
190 hunspell_LIB_DEPENDS=   libhunspell-1.6.so:textproc/hunspell
191 hunspell_MOZ_OPTIONS=   --enable-system-hunspell
192
193 icu_LIB_DEPENDS=                libicui18n.so:devel/icu
194 icu_MOZ_OPTIONS=                --with-system-icu --with-intl-api
195
196 -jpeg_BUILD_DEPENDS=yasm:devel/yasm
197 # XXX Remove files/patch-ijg-libjpeg once -turbo is default
198 jpeg_USES=              jpeg
199 jpeg_MOZ_OPTIONS=       --with-system-jpeg=${LOCALBASE}
200
201 nspr_LIB_DEPENDS=       libnspr4.so:devel/nspr
202 nspr_MOZ_OPTIONS=       --with-system-nspr
203
204 nss_LIB_DEPENDS=        libnss3.so:security/nss
205 nss_MOZ_OPTIONS=        --with-system-nss
206
207 pixman_LIB_DEPENDS=     libpixman-1.so:x11/pixman
208 pixman_MOZ_OPTIONS=     --enable-system-pixman
209
210 png_LIB_DEPENDS=        libpng.so:graphics/png
211 png_MOZ_OPTIONS=        --with-system-png=${LOCALBASE}
212
213 .if exists(${FILESDIR}/patch-z-bug517422)
214 soundtouch_LIB_DEPENDS= libSoundTouch.so:audio/soundtouch
215 soundtouch_MOZ_OPTIONS= --with-system-soundtouch
216 .endif
217
218 sqlite_LIB_DEPENDS=     libsqlite3.so:databases/sqlite3
219 sqlite_MOZ_OPTIONS=     --enable-system-sqlite
220
221 .if exists(${FILESDIR}/patch-z-bug517422)
222 # XXX disabled: update to 1.2.x or review backported fixes
223 theora_LIB_DEPENDS=     libtheora.so:multimedia/libtheora
224 theora_MOZ_OPTIONS=     --with-system-theora
225
226 tremor_LIB_DEPENDS=     libogg.so:audio/libogg libvorbisidec.so:audio/libtremor
227 tremor_MOZ_OPTIONS=     --with-system-tremor --with-system-ogg
228
229 vorbis_LIB_DEPENDS=     libogg.so:audio/libogg libvorbis.so:audio/libvorbis
230 vorbis_MOZ_OPTIONS=     --with-system-vorbis --with-system-ogg
231 .endif
232
233 -vpx_BUILD_DEPENDS=     yasm:devel/yasm
234 vpx_LIB_DEPENDS=        libvpx.so:multimedia/libvpx
235 vpx_MOZ_OPTIONS=        --with-system-libvpx
236
237 .for use in ${USE_MOZILLA}
238 ${use:S/-/_WITHOUT_/}=  ${TRUE}
239 .endfor
240
241 LIB_DEPENDS+=   libfontconfig.so:x11-fonts/fontconfig \
242                 libfreetype.so:print/freetype2
243
244 .for dep in ${_ALL_DEPENDS} ${USE_MOZILLA:M+*:S/+//}
245 .if !defined(_WITHOUT_${dep})
246 BUILD_DEPENDS+= ${${dep}_BUILD_DEPENDS}
247 LIB_DEPENDS+=   ${${dep}_LIB_DEPENDS}
248 RUN_DEPENDS+=   ${${dep}_RUN_DEPENDS}
249 USES+=          ${${dep}_USES}
250 MOZ_OPTIONS+=   ${${dep}_MOZ_OPTIONS}
251 .else
252 BUILD_DEPENDS+= ${-${dep}_BUILD_DEPENDS}
253 .endif
254 .endfor
255
256 # Standard options
257 MOZ_CHROME?=    omni
258 MOZ_TOOLKIT?=   cairo-gtk3
259 MOZ_CHANNEL?=   ${PKGNAMESUFFIX:Urelease:S/^-//}
260 MOZ_OPTIONS+=   \
261                 --enable-chrome-format=${MOZ_CHROME} \
262                 --enable-default-toolkit=${MOZ_TOOLKIT} \
263                 --enable-update-channel=${MOZ_CHANNEL} \
264                 --disable-updater \
265                 --enable-pie \
266                 --with-pthreads
267 # others
268 MOZ_OPTIONS+=   --with-system-zlib              \
269                 --with-system-bz2
270
271 # API keys from www/chromium 
272 # http://www.chromium.org/developers/how-tos/api-keys
273 # Note: these are for FreeBSD use ONLY. For your own distribution,
274 # please get your own set of keys.
275 MOZ_EXPORT+=    MOZ_GOOGLE_API_KEY=AIzaSyBsp9n41JLW8jCokwn7vhoaMejDFRd1mp8
276
277 .if ${PORT_OPTIONS:MGTK2}
278 MOZ_TOOLKIT=    cairo-gtk2
279 .endif
280
281 .if ${MOZ_TOOLKIT:Mcairo-gtk3}
282 BUILD_DEPENDS+= gtk3>=3.14.6:x11-toolkits/gtk30
283 USE_GNOME+=     gdkpixbuf2 gtk20 gtk30
284 .else # gtk2, cairo-gtk2
285 USE_GNOME+=     gdkpixbuf2 gtk20
286 .endif
287
288 .if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
289 CFLAGS+=                -O3
290 MOZ_EXPORT+=    MOZ_OPTIMIZE_FLAGS="${CFLAGS:M-O*}"
291 MOZ_OPTIONS+=   --enable-optimize
292 .else
293 MOZ_OPTIONS+=   --disable-optimize
294 . if ${MOZILLA_VER:R:R} >= 56
295 .  if ${/usr/bin/ld:L:tA} != /usr/bin/ld.lld
296 # ld 2.17 barfs on Stylo built with -C opt-level=0
297 USE_BINUTILS=   yes
298 LDFLAGS+=               -B${LOCALBASE}/bin
299 .  endif
300 . endif
301 .endif
302
303 .if ${PORT_OPTIONS:MCANBERRA}
304 RUN_DEPENDS+=   libcanberra>0:audio/libcanberra
305 .endif
306
307 .if ${PORT_OPTIONS:MDBUS}
308 BUILD_DEPENDS+= libnotify>0:devel/libnotify
309 LIB_DEPENDS+=   libdbus-1.so:devel/dbus \
310                                 libdbus-glib-1.so:devel/dbus-glib \
311                                 libstartup-notification-1.so:x11/startup-notification
312 MOZ_OPTIONS+=   --enable-startup-notification
313 .else
314 MOZ_OPTIONS+=   --disable-dbus
315 .endif
316
317 .if ${PORT_OPTIONS:MFFMPEG}
318 # dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
319 RUN_DEPENDS+=   ffmpeg>=0.8,1:multimedia/ffmpeg
320 .endif
321
322 .if ${MOZILLA_VER:R:R} < 46
323 MOZ_OPTIONS+=   --disable-gstreamer
324 .endif
325
326 .if ${PORT_OPTIONS:MGCONF}
327 USE_GNOME+=             gconf2
328 MOZ_OPTIONS+=   --enable-gconf
329 .else
330 MOZ_OPTIONS+=   --disable-gconf
331 .endif
332
333 .if ${PORT_OPTIONS:MLIBPROXY}
334 LIB_DEPENDS+=   libproxy.so:net/libproxy
335 MOZ_OPTIONS+=   --enable-libproxy
336 .else
337 MOZ_OPTIONS+=   --disable-libproxy
338 .endif
339
340 .if ${PORT_OPTIONS:MALSA}
341 LIB_DEPENDS+=   libasound.so:audio/alsa-lib
342 RUN_DEPENDS+=   ${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:audio/alsa-plugins
343 RUN_DEPENDS+=   alsa-lib>=1.1.1_1:audio/alsa-lib
344 MOZ_OPTIONS+=   --enable-alsa
345 .endif
346
347 .if ${PORT_OPTIONS:MJACK}
348 BUILD_DEPENDS+= ${LOCALBASE}/include/jack/jack.h:audio/jack
349 MOZ_OPTIONS+=   --enable-jack
350 .endif
351
352 .if ${PORT_OPTIONS:MPULSEAUDIO}
353 BUILD_DEPENDS+= ${LOCALBASE}/include/pulse/pulseaudio.h:audio/pulseaudio
354 MOZ_OPTIONS+=   --enable-pulseaudio
355 .else
356 MOZ_OPTIONS+=   --disable-pulseaudio
357 .endif
358
359 .if ${PORT_OPTIONS:MSNDIO}
360 LIB_DEPENDS+=   libsndio.so:audio/sndio
361 post-patch-SNDIO-on:
362         @${REINPLACE_CMD} -e 's|OpenBSD|${OPSYS}|g' \
363                 ${MOZSRC}/media/libcubeb/src/moz.build \
364                 ${MOZSRC}/toolkit/library/moz.build
365 . for tests in tests gtest
366         @if [ -f "${MOZSRC}/media/libcubeb/${tests}/moz.build" ]; then \
367                 ${REINPLACE_CMD} -e 's|OpenBSD|${OPSYS}|g' \
368                          ${MOZSRC}/media/libcubeb/${tests}/moz.build; \
369         fi
370 . endfor
371         @if [ -f "${MOZSRC}/media/webrtc/trunk/webrtc/build/common.gypi" ]; then \
372                 ${REINPLACE_CMD} -e 's|OS==\"openbsd\"|OS==\"${OPSYS:tl}\"|g' \
373                         ${MOZSRC}/media/webrtc/trunk/webrtc/build/common.gypi; \
374         fi
375         @if [ -f "${MOZSRC}/media/webrtc/signaling/test/common.build" ]; then \
376                 ${ECHO_CMD} "OS_LIBS += ['sndio']" >> \
377                         ${MOZSRC}/media/webrtc/signaling/test/common.build; \
378         fi
379 .endif
380
381 .if ${PORT_OPTIONS:MRUST} || ${MOZILLA_VER:R:R} >= 54
382 BUILD_DEPENDS+= ${RUST_PORT:T}>=1.21.0:${RUST_PORT}
383 RUST_PORT?=             lang/rust
384 . if ${MOZILLA_VER:R:R} < 54
385 MOZ_OPTIONS+=   --enable-rust
386 . endif
387 .else
388 MOZ_OPTIONS+=   --disable-rust
389 .endif
390
391 .if ${PORT_OPTIONS:MDEBUG}
392 MOZ_OPTIONS+=   --enable-debug --disable-release
393 STRIP=  # ports/184285
394 .else
395 MOZ_OPTIONS+=   --disable-debug --disable-debug-symbols --enable-release
396 . if ${MOZILLA_VER:R:R} >= 56 && (${ARCH:Maarch64} || ${MACHINE_CPU:Msse2})
397 MOZ_OPTIONS+=   --enable-rust-simd
398 . endif
399 .endif
400
401 .if ${PORT_OPTIONS:MDTRACE}
402 MOZ_OPTIONS+=   --enable-dtrace \
403                 --disable-gold
404 . if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100061
405 LIBS+=                  -lelf
406 . endif
407 STRIP=
408 .else
409 MOZ_OPTIONS+=   --disable-dtrace
410 .endif
411
412 .if ${PORT_OPTIONS:MPROFILE}
413 MOZ_OPTIONS+=   --enable-profiling
414 STRIP=
415 .else
416 MOZ_OPTIONS+=   --disable-profiling
417 .endif
418
419 .if ${PORT_OPTIONS:MTEST}
420 USE_XORG+=              xscrnsaver
421 MOZ_OPTIONS+=   --enable-tests
422 .else
423 MOZ_OPTIONS+=   --disable-tests
424 .endif
425
426 .if !defined(STRIP) || ${STRIP} == ""
427 MOZ_OPTIONS+=   --disable-strip --disable-install-strip
428 .else
429 MOZ_OPTIONS+=   --enable-strip --enable-install-strip
430 .endif
431
432 # _MAKE_JOBS is only available after bsd.port.post.mk, thus cannot be
433 # used in .mozconfig. And client.mk automatically uses -jN where N
434 # is what multiprocessing.cpu_count() returns.
435 .if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE)
436 MAKE_JOBS_NUMBER=       1
437 .endif
438 .if defined(MAKE_JOBS_NUMBER)
439 MOZ_MAKE_FLAGS+=-j${MAKE_JOBS_NUMBER}
440 .endif
441
442 .if defined(MOZ_MAKE_FLAGS)
443 MOZ_MK_OPTIONS+=MOZ_MAKE_FLAGS="${MOZ_MAKE_FLAGS}"
444 .endif
445
446 MOZ_SED_ARGS+=  -e's|@CPPFLAGS@|${CPPFLAGS}|g'          \
447                 -e 's|@CFLAGS@|${CFLAGS}|g'             \
448                 -e 's|@LDFLAGS@|${LDFLAGS}|g'           \
449                 -e 's|@LIBS@|${LIBS}|g'                 \
450                 -e 's|@LOCALBASE@|${LOCALBASE}|g'       \
451                 -e 's|@PERL@|${PERL}|g'                 \
452                 -e 's|@MOZDIR@|${PREFIX}/lib/${MOZILLA}|g'      \
453                 -e 's|%%PREFIX%%|${PREFIX}|g'           \
454                 -e 's|%%CFLAGS%%|${CFLAGS}|g'           \
455                 -e 's|%%LDFLAGS%%|${LDFLAGS}|g'         \
456                 -e 's|%%LIBS%%|${LIBS}|g'               \
457                 -e 's|%%LOCALBASE%%|${LOCALBASE}|g'     \
458                 -e 's|%%PERL%%|${PERL}|g'               \
459                 -e 's|%%MOZILLA%%|${MOZILLA}|g'         \
460                 -e 's|%%MOZILLA_BIN%%|${MOZILLA_BIN}|g' \
461                 -e 's|%%MOZDIR%%|${PREFIX}/lib/${MOZILLA}|g'
462 MOZCONFIG_SED?= ${SED} ${MOZ_SED_ARGS}
463
464 .if ${ARCH} == amd64
465 . if ${USE_MOZILLA:M-nss}
466 USE_BINUTILS=   # intel-gcm.s
467 CFLAGS+=        -B${LOCALBASE}/bin
468 LDFLAGS+=       -B${LOCALBASE}/bin
469 . endif
470 .elif ${ARCH:Mpowerpc*}
471 . if ${ARCH} == "powerpc64"
472 MOZ_EXPORT+=    UNAME_m="${ARCH}"
473 CFLAGS+=        -mminimal-toc
474 . endif
475 .elif ${ARCH} == "sparc64"
476 # Work around miscompilation/mislinkage of the sCanonicalVTable hacks.
477 MOZ_OPTIONS+=   --disable-v1-string-abi
478 .endif
479
480 .else # bsd.port.post.mk
481
482 post-patch: gecko-post-patch gecko-moz-pis-patch
483
484 gecko-post-patch:
485 .if exists(${PKGINSTALL_INC})
486         @${MOZCONFIG_SED} < ${PKGINSTALL_INC} > ${PKGINSTALL}
487 .endif
488 .if exists(${PKGDEINSTALL_INC})
489         @${MOZCONFIG_SED} < ${PKGDEINSTALL_INC} > ${PKGDEINSTALL}
490 .endif
491         @${RM} ${MOZCONFIG}
492 .if !defined(NOMOZCONFIG)
493         @if [ -e ${PORT_MOZCONFIG} ] ; then \
494                 ${MOZCONFIG_SED} < ${PORT_MOZCONFIG} >> ${MOZCONFIG} ; \
495         fi
496 .for arg in ${MOZ_OPTIONS}
497         @${ECHO_CMD} ac_add_options ${arg:Q} >> ${MOZCONFIG}
498 .endfor
499 .for arg in ${MOZ_MK_OPTIONS}
500         @${ECHO_CMD} mk_add_options ${arg:Q} >> ${MOZCONFIG}
501 .endfor
502 .for var in ${MOZ_EXPORT}
503         @${ECHO_CMD} export ${var:Q} >> ${MOZCONFIG}
504 .endfor
505 .endif # .if !defined(NOMOZCONFIG)
506 .if exists(${MOZSRC}/build/unix/mozilla-config.in)
507         @${REINPLACE_CMD} -e  's/%{idldir}/%idldir%/g ; \
508                 s|"%FULL_NSPR_CFLAGS%"|`nspr-config --cflags`|g ; \
509                 s|"%FULL_NSPR_LIBS%"|`nspr-config --libs`|g' \
510                         ${MOZSRC}/build/unix/mozilla-config.in
511 .endif
512 .if ${USE_MOZILLA:M-nspr}
513         @${ECHO_MSG} "===>  Applying NSPR patches"
514         @for i in ${.CURDIR}/../../devel/nspr/files/patch-*; do \
515                 ${PATCH} ${PATCH_ARGS} -d ${MOZSRC}/nsprpub < $$i; \
516         done
517 .endif
518 .if ${USE_MOZILLA:M-nss}
519         @${ECHO_MSG} "===>  Applying NSS patches"
520         @for i in ${.CURDIR}/../../security/nss/files/patch-*; do \
521                 ${PATCH} ${PATCH_ARGS} -d ${MOZSRC}/security/nss < $$i; \
522         done
523 .endif
524         @for f in \
525                         ${WRKSRC}/directory/c-sdk/config/FreeBSD.mk \
526                         ${WRKSRC}/directory/c-sdk/configure \
527                         ${MOZSRC}/security/coreconf/FreeBSD.mk \
528                         ${MOZSRC}/js/src/Makefile.in \
529                         ${MOZSRC}/js/src/configure \
530                         ${MOZSRC}/configure \
531                         ${WRKSRC}/configure; do \
532                 if [ -f $$f ] ; then \
533                         ${REINPLACE_CMD} -Ee 's|-lc_r|-pthread|g ; \
534                                 s|-l?pthread|-pthread|g ; \
535                                 s|echo aout|echo elf|g ; \
536                                 s|/usr/X11R6|${LOCALBASE}|g' \
537                                 $$f; \
538                 fi; \
539         done
540         @if [ -f ${WRKSRC}/config/baseconfig.mk ] ; then \
541                 ${REINPLACE_CMD} -e 's|%%MOZILLA%%|${MOZILLA}|g' \
542                         ${WRKSRC}/config/baseconfig.mk; \
543         fi
544         @${REINPLACE_CMD} -e 's|%%MOZILLA%%|${MOZILLA}|g' \
545                         ${MOZSRC}/config/baseconfig.mk
546         @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g ; \
547                 s|%%LOCALBASE%%|${LOCALBASE}|g' \
548                         ${MOZSRC}/build/unix/run-mozilla.sh
549         @${REINPLACE_CMD} -e 's|/usr/local/netscape|${LOCALBASE}|g ; \
550                 s|/usr/local/lib/netscape|${LOCALBASE}/lib|g' \
551                 ${MOZSRC}/xpcom/io/SpecialSystemDirectory.cpp
552         @${REINPLACE_CMD} -e 's|/etc|${PREFIX}&|g' \
553                 ${MOZSRC}/xpcom/build/nsXPCOMPrivate.h
554         @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
555                 -e 's|mozilla/plugins|browser_plugins|g' \
556                 -e 's|share/mozilla/extensions|lib/xpi|g' \
557                 ${MOZSRC}/xpcom/io/nsAppFileLocationProvider.cpp \
558                 ${MOZSRC}/toolkit/xre/nsXREDirProvider.cpp
559         @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
560                 ${MOZSRC}/extensions/spellcheck/hunspell/*/mozHunspell.cpp
561
562 # handles mozilla pis scripts.
563 gecko-moz-pis-patch:
564 .for moz in ${MOZ_PIS_SCRIPTS}
565         @${MOZCONFIG_SED} < ${FILESDIR}/${moz} > ${WRKDIR}/${moz}
566 .endfor
567
568 pre-install: gecko-moz-pis-pre-install
569 post-install-script: gecko-create-plist
570
571 gecko-create-plist:
572 # Create the plist
573         ${RM} ${PLISTF}
574 .for dir in ${MOZILLA_PLIST_DIRS}
575         @cd ${STAGEDIR}${PREFIX}/${dir} && ${FIND} -H -s * ! -type d | \
576                 ${SED} -e 's|^|${dir}/|' >> ${PLISTF}
577 .endfor
578         ${CAT} ${PLISTF} | ${SORT} >> ${TMPPLIST}
579
580 gecko-moz-pis-pre-install:
581 .if defined(MOZ_PIS_SCRIPTS)
582         ${MKDIR} ${STAGEDIR}${PREFIX}/${MOZ_PIS_DIR}
583 .for moz in ${MOZ_PIS_SCRIPTS}
584         ${INSTALL_SCRIPT} ${WRKDIR}/${moz} ${STAGEDIR}${PREFIX}/${MOZ_PIS_DIR}
585 .endfor
586 .endif
587
588 .endif
589 .endif
590 # HERE THERE BE TACOS -- adamw