4 # Date created: 12 Nov 2005
5 # Whom: Michael Johnson <ahze@FreeBSD.org>
9 # 4 column tabs prevent hair loss and tooth decay!
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
18 .if defined(USE_GECKO)
19 .if !defined(_POSTMKINCLUDED) && !defined(Gecko_Pre_Include)
20 Gecko_Pre_Include= bsd.gecko.mk
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.
27 # You need to make sure to add USE_GECKO=gecko to for your port can uses
28 # one of these options below.
30 # Ports can use the following:
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
38 # GECKO_PLIST_PRE_FILES Manual add files in the plist if it needs.
40 # GECKO_PLIST_PRE_DIRS Manual directories in the plist if it needs.
42 # MOZILLA_PLIST_DIRS List of directories to descend into when installing
43 # and creating the plist
45 # MOZ_PIS_SCRIPTS List of scripts residing in ${FILESDIR} to be
46 # filtered through MOZCONFIG_SED and installed along
47 # with our Pluggable Init Scripts (PIS)
49 # MOZ_SED_ARGS sed(1) commands through which MOZ_PIS_SCRIPTS are
50 # filtered. There is a default set defined here, so
51 # you probably want to add to MOZ_SED_ARGS rather
54 # MOZ_OPTIONS configure arguments (added to .mozconfig). If
55 # NOMOZCONFIG is defined, you probably want to set
56 # CONFIGURE_ARGS+=${MOZ_OPTIONS}
58 # MOZ_MK_OPTIONS The make(1) arguments (added to .mozconfig). If
59 # NOMOZCONFIG is defined, you probably want to set
60 # MAKE_ARGS+=${MOZ_MK_OPTIONS}
62 # MOZ_EXPORT Environment variables for the build process (added
63 # to .mozconfig). If NOMOZCONFIG is defined, you
64 # probably want to set MAKE_ENV+=${MOZ_EXPORT}
66 # MOZ_CHROME A variable for the --enable-chrome-format= in
67 # CONFIGURE_ARGS. The default is omni.
69 # MOZ_TOOLKIT A variable for the --enable-default-toolkit= in
70 # CONFIGURE_ARGS. The default is cairo-gtk2.
72 # MOZ_EXTENSIONS A list of extensions to build
74 # MOZ_PROTOCOLS A list of protocols to build (http, ftp, etc.)
76 # PORT_MOZCONFIG Defaults to ${FILESDIR}/mozconfig.in, but can be
77 # set to a generic mozconfig included with the port
79 # NOGECKO_INSTALL Don't install the built gecko (most likely for
82 # NOGECKO_PLIST Don't create a dynamically-generated playlist
84 # NOMOZCONFIG Don't drop a customized .mozconfig into the build
85 # directory. Options will have to be specified in
86 # CONFIGURE_ARGS instead
89 MAINTAINER?= gecko@FreeBSD.org
92 MOZILLA_VER?= ${PORTVERSION}
93 MOZILLA_BIN?= ${PORTNAME}-bin
94 MOZILLA_EXEC_NAME?=${MOZILLA}
95 MOZ_RPATH?= ${MOZILLA}
96 USE_GNOME+= desktopfileutils
97 USES+= compiler:c++11-lib gmake iconv perl5 pkgconfig
99 USE_XORG= xext xrender xt
105 WRKSRC?= ${WRKDIR}/mozilla
106 FAKEDIR?= ${WRKDIR}/fake
107 PLIST?= ${WRKDIR}/plist
108 PLISTD?= ${WRKDIR}/plist_dirs
109 PLISTF?= ${WRKDIR}/plist_files
111 MOZ_PIS_DIR?= lib/${MOZILLA}/init.d
113 PORT_MOZCONFIG?= ${FILESDIR}/mozconfig.in
114 MOZCONFIG?= ${WRKSRC}/.mozconfig
115 MOZILLA_PLIST_DIRS?= bin lib
116 PKGINSTALL?= ${WRKDIR}/pkg-install
117 PKGDEINSTALL?= ${WRKDIR}/pkg-deinstall
118 PKGINSTALL_INC?= ${.CURDIR}/../../www/firefox/files/pkg-install.in
119 PKGDEINSTALL_INC?= ${.CURDIR}/../../www/firefox/files/pkg-deinstall.in
121 EXTRACT_AFTER_ARGS?= --exclude */CVS/* \
122 --exclude */macbuild/* \
123 --exclude */package/* \
124 --exclude mozilla*/gc/boehm
126 MOZ_PKGCONFIG_FILES?= ${MOZILLA}-gtkmozembed ${MOZILLA}-js \
127 ${MOZILLA}-xpcom ${MOZILLA}-plugin
129 MOZ_EXPORT+= ${CONFIGURE_ENV} \
130 LIBS="${LIBS}" PERL="${PERL}"
131 MOZ_OPTIONS+= --prefix="${FAKEDIR}"
133 CPPFLAGS+= -isystem${LOCALBASE}/include
134 LDFLAGS+= -L${LOCALBASE}/lib -Wl,-rpath,${PREFIX}/lib/${MOZILLA}
136 # use jemalloc 3.0.0 API for stats/tuning
137 MOZ_EXPORT+= MOZ_JEMALLOC3=1
138 .if ${OSVERSION} < 1000012
139 MOZ_OPTIONS+= --enable-jemalloc
143 _ALL_DEPENDS= cairo event ffi harfbuzz hunspell icu jpeg nspr nss opus png pixman sqlite vorbis vpx
145 cairo_LIB_DEPENDS= libcairo.so:${PORTSDIR}/graphics/cairo
146 cairo_MOZ_OPTIONS= --enable-system-cairo
147 cairo_EXTRACT_AFTER_ARGS= --exclude mozilla*/gfx/cairo/cairo
149 event_LIB_DEPENDS= libevent-2.0.so:${PORTSDIR}/devel/libevent2
150 event_MOZ_OPTIONS= --with-system-libevent
151 event_EXTRACT_AFTER_ARGS= --exclude mozilla*/ipc/chromium/src/third_party/libevent
153 ffi_LIB_DEPENDS= libffi.so:${PORTSDIR}/devel/libffi
154 ffi_MOZ_OPTIONS= --enable-system-ffi
155 ffi_EXTRACT_AFTER_ARGS= --exclude mozilla*/js/src/ctypes/libffi
157 .if exists(${FILESDIR}/patch-bug847568) || exists(${FILESDIR}/patch-z-bug847568)
158 harfbuzz_LIB_DEPENDS= libharfbuzz.so:${PORTSDIR}/print/harfbuzz
159 harfbuzz_MOZ_OPTIONS= --with-system-harfbuzz --with-system-graphite2
160 harfbuzz_EXTRACT_AFTER_ARGS= --exclude mozilla*/gfx/harfbuzz \
161 --exclude mozilla*/gfx/graphite2
164 hunspell_LIB_DEPENDS= libhunspell-1.3.so:${PORTSDIR}/textproc/hunspell
165 hunspell_MOZ_OPTIONS= --enable-system-hunspell
167 icu_LIB_DEPENDS= libicui18n.so:${PORTSDIR}/devel/icu
168 icu_MOZ_OPTIONS= --with-system-icu --with-intl-api --enable-intl-api
170 -jpeg_BUILD_DEPENDS=yasm:${PORTSDIR}/devel/yasm
171 # XXX depends on ports/180159 or package flavor support
172 #jpeg_LIB_DEPENDS= libjpeg.so:${PORTSDIR}/graphics/libjpeg-turbo
173 jpeg_LIB_DEPENDS= libjpeg.so:${PORTSDIR}/graphics/jpeg
174 jpeg_MOZ_OPTIONS= --with-system-jpeg=${LOCALBASE}
175 jpeg_EXTRACT_AFTER_ARGS= --exclude mozilla*/media/libjpeg
177 nspr_LIB_DEPENDS= libnspr4.so:${PORTSDIR}/devel/nspr
178 nspr_MOZ_OPTIONS= --with-system-nspr
180 nss_LIB_DEPENDS= libnss3.so:${PORTSDIR}/security/nss
181 nss_MOZ_OPTIONS= --with-system-nss
182 nss_EXTRACT_AFTER_ARGS= --exclude mozilla*/dbm \
183 --exclude mozilla*/security/coreconf \
184 --exclude mozilla*/security/nss
186 .if exists(${FILESDIR}/patch-z-bug517422) || exists(${FILESDIR}/patch-zz-bug517422)
187 opus_LIB_DEPENDS= libopus.so:${PORTSDIR}/audio/opus
188 opus_MOZ_OPTIONS= --with-system-opus
189 opus_EXTRACT_AFTER_ARGS= --exclude mozilla*/media/libopus
192 pixman_LIB_DEPENDS= libpixman-1.so:${PORTSDIR}/x11/pixman
193 pixman_MOZ_OPTIONS= --enable-system-pixman
194 pixman_EXTRACT_AFTER_ARGS= --exclude mozilla*/gfx/cairo/libpixman
196 png_LIB_DEPENDS= libpng15.so:${PORTSDIR}/graphics/png
197 png_MOZ_OPTIONS= --with-system-png=${LOCALBASE}
198 png_EXTRACT_AFTER_ARGS= --exclude mozilla*/media/libpng
200 sqlite_LIB_DEPENDS= libsqlite3.so:${PORTSDIR}/databases/sqlite3
201 sqlite_MOZ_OPTIONS= --enable-system-sqlite
202 sqlite_EXTRACT_AFTER_ARGS= --exclude mozilla*/db/sqlite3
204 .if exists(${FILESDIR}/patch-z-bug517422) || exists(${FILESDIR}/patch-zz-bug517422)
205 vorbis_LIB_DEPENDS= libvorbis.so:${PORTSDIR}/audio/libvorbis
206 vorbis_MOZ_OPTIONS= --with-system-vorbis --with-system-ogg
207 vorbis_EXTRACT_AFTER_ARGS= --exclude mozilla*/media/libvorbis \
208 --exclude mozilla*/media/libogg
211 -vpx_BUILD_DEPENDS= yasm:${PORTSDIR}/devel/yasm
212 vpx_LIB_DEPENDS= libvpx.so:${PORTSDIR}/multimedia/libvpx
213 vpx_MOZ_OPTIONS= --with-system-libvpx
214 vpx_EXTRACT_AFTER_ARGS= --exclude mozilla*/media/libvpx
216 .for use in ${USE_MOZILLA}
217 ${use:S/-/_WITHOUT_/}= ${TRUE}
220 .for dep in ${_ALL_DEPENDS}
221 .if !defined(_WITHOUT_${dep})
222 BUILD_DEPENDS+= ${${dep}_BUILD_DEPENDS}
223 LIB_DEPENDS+= ${${dep}_LIB_DEPENDS}
224 RUN_DEPENDS+= ${${dep}_RUN_DEPENDS}
225 MOZ_OPTIONS+= ${${dep}_MOZ_OPTIONS}
226 EXTRACT_AFTER_ARGS+= ${${dep}_EXTRACT_AFTER_ARGS}
228 BUILD_DEPENDS+= ${-${dep}_BUILD_DEPENDS}
234 MOZ_TOOLKIT?= cairo-gtk2
236 --enable-chrome-format=${MOZ_CHROME} \
237 --enable-default-toolkit=${MOZ_TOOLKIT} \
239 # Configure options for install
240 .if !defined(MOZ_EXTENSIONS)
241 MOZ_OPTIONS+= --enable-extensions=default
243 MOZ_OPTIONS+= --enable-extensions=${MOZ_EXTENSIONS}
245 .if !defined(MOZ_PROTOCOLS)
246 MOZ_OPTIONS+= --enable-necko-protocols=default
248 MOZ_OPTIONS+= --enable-necko-protocols=${MOZ_PROTOCOLS}
251 MOZ_OPTIONS+= --with-system-zlib \
253 --enable-unified-compilation \
254 --disable-debug-symbols \
257 --disable-freetypetest \
258 --disable-installer \
262 # XXX stolen from www/chromium
263 MOZ_EXPORT+= MOZ_GOOGLE_API_KEY=AIzaSyBsp9n41JLW8jCokwn7vhoaMejDFRd1mp8
265 .if ${PORT_OPTIONS:MGTK3}
266 MOZ_TOOLKIT= cairo-gtk3
269 .if ${MOZ_TOOLKIT:Mcairo-qt}
270 # don't use - transparent backgrounds (bug 521582),
271 USE_MOZILLA+= -cairo # ports/169343
272 USE_DISPLAY=yes # install
274 . if ${MOZILLA_VER:R:R} >= 30
275 USE_QT5+= qmake_build buildtools_build gui network quick printsupport
277 USE_QT4+= qmake_build moc_build rcc_build gui network opengl
279 MOZ_EXPORT+= HOST_QMAKE="${QMAKE}" HOST_MOC="${MOC}" HOST_RCC="${RCC}"
280 .elif ${MOZ_TOOLKIT:Mcairo-gtk3}
282 .else # gtk2, cairo-gtk2
286 .if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
288 MOZ_EXPORT+= MOZ_OPTIMIZE_FLAGS="${CFLAGS:M-O*}"
289 MOZ_OPTIONS+= --enable-optimize
291 MOZ_OPTIONS+= --disable-optimize
294 .if ${PORT_OPTIONS:MDBUS}
295 BUILD_DEPENDS+= libnotify>0:${PORTSDIR}/devel/libnotify
296 LIB_DEPENDS+= libdbus-glib-1.so:${PORTSDIR}/devel/dbus-glib \
297 libstartup-notification-1.so:${PORTSDIR}/x11/startup-notification
298 MOZ_OPTIONS+= --enable-startup-notification
300 MOZ_OPTIONS+= --disable-dbus --disable-libnotify
303 .if ${PORT_OPTIONS:MGSTREAMER}
304 . if ${MOZILLA_VER:R:R} >= 30 || exists(${FILESDIR}/patch-bug806917)
305 USE_GSTREAMER1?=good libav
306 MOZ_OPTIONS+= --enable-gstreamer=1.0
308 USE_GSTREAMER?= good ffmpeg
309 MOZ_OPTIONS+= --enable-gstreamer
312 MOZ_OPTIONS+= --disable-gstreamer
315 .if ${PORT_OPTIONS:MGCONF}
316 BUILD_DEPENDS+= ${gconf2_DETECT}:${gconf2_LIB_DEPENDS:C/.*://}
317 USE_GNOME+= gconf2:build
318 MOZ_OPTIONS+= --enable-gconf
320 MOZ_OPTIONS+= --disable-gconf
323 .if ${PORT_OPTIONS:MGIO} && ! ${MOZ_TOOLKIT:Mcairo-qt}
324 MOZ_OPTIONS+= --enable-gio
326 MOZ_OPTIONS+= --disable-gio
329 .if ${PORT_OPTIONS:MGNOMEUI}
330 BUILD_DEPENDS+= ${libgnomeui_DETECT}:${libgnomeui_LIB_DEPENDS:C/.*://}
331 USE_GNOME+= libgnomeui:build
332 MOZ_OPTIONS+= --enable-gnomeui
334 MOZ_OPTIONS+= --disable-gnomeui
337 .if ${PORT_OPTIONS:MGNOMEVFS2}
338 BUILD_DEPENDS+= ${gnomevfs2_DETECT}:${gnomevfs2_LIB_DEPENDS:C/.*://}
339 USE_GNOME+= gnomevfs2:build
340 MOZ_OPTIONS+= --enable-gnomevfs
341 MOZ_OPTIONS:= ${MOZ_OPTIONS:C/(extensions)=(.*)/\1=\2,gnomevfs/}
343 MOZ_OPTIONS+= --disable-gnomevfs
346 .if ${PORT_OPTIONS:MLIBPROXY}
347 LIB_DEPENDS+= libproxy.so:${PORTSDIR}/net/libproxy
348 MOZ_OPTIONS+= --enable-libproxy
350 MOZ_OPTIONS+= --disable-libproxy
353 .if ${PORT_OPTIONS:MPGO}
358 MAKEFILE= ${WRKSRC}/client.mk
359 ALL_TARGET= profiledbuild
360 MOZ_EXPORT+=MOZ_OPTIMIZE_FLAGS="-Os" MOZ_PGO_OPTIMIZE_FLAGS="${CFLAGS:M-O*}"
363 .if ${PORT_OPTIONS:MALSA}
364 LIB_DEPENDS+= libasound.so:${PORTSDIR}/audio/alsa-lib
365 RUN_DEPENDS+= ${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:${PORTSDIR}/audio/alsa-plugins
366 MOZ_OPTIONS+= --enable-alsa
369 .if ${PORT_OPTIONS:MPULSEAUDIO}
370 BUILD_DEPENDS+= pulseaudio>0:${PORTSDIR}/audio/pulseaudio
371 MOZ_OPTIONS+= --enable-pulseaudio
373 MOZ_OPTIONS+= --disable-pulseaudio
376 .if ${PORT_OPTIONS:MDEBUG}
377 MOZ_OPTIONS+= --enable-debug --disable-release
378 STRIP= # ports/184285
380 MOZ_OPTIONS+= --disable-debug --enable-release
383 .if ${PORT_OPTIONS:MLOGGING} || ${PORT_OPTIONS:MDEBUG}
384 MOZ_OPTIONS+= --enable-logging
386 MOZ_OPTIONS+= --disable-logging
389 .if ${PORT_OPTIONS:MPROFILE}
390 MOZ_OPTIONS+= --enable-profiling
393 MOZ_OPTIONS+= --disable-profiling
396 .if ${PORT_OPTIONS:MTEST}
397 USE_XORG+= xscrnsaver
398 MOZ_OPTIONS+= --enable-tests
400 MOZ_OPTIONS+= --disable-tests
403 .if !defined(STRIP) || ${STRIP} == ""
404 MOZ_OPTIONS+= --disable-strip --disable-install-strip
406 MOZ_OPTIONS+= --enable-strip --enable-install-strip
409 MOZ_SED_ARGS+= -e's|@CPPFLAGS@|${CPPFLAGS}|g' \
410 -e 's|@CFLAGS@|${CFLAGS}|g' \
411 -e 's|@LDFLAGS@|${LDFLAGS}|g' \
412 -e 's|@LIBS@|${LIBS}|g' \
413 -e 's|@LOCALBASE@|${LOCALBASE}|g' \
414 -e 's|@FAKEDIR@|${FAKEDIR}|g' \
415 -e 's|@PERL@|${PERL5}|g' \
416 -e 's|@MOZDIR@|${PREFIX}/lib/${MOZILLA}|g' \
417 -e 's|%%PREFIX%%|${PREFIX}|g' \
418 -e 's|%%CFLAGS%%|${CFLAGS}|g' \
419 -e 's|%%LDFLAGS%%|${LDFLAGS}|g' \
420 -e 's|%%LIBS%%|${LIBS}|g' \
421 -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
422 -e 's|%%FAKEDIR%%|${FAKEDIR}|g' \
423 -e 's|%%PERL%%|${PERL5}|g' \
424 -e 's|%%MOZILLA%%|${MOZILLA}|g' \
425 -e 's|%%MOZILLA_BIN%%|${MOZILLA_BIN}|g' \
426 -e 's|%%MOZDIR%%|${PREFIX}/lib/${MOZILLA}|g'
427 MOZCONFIG_SED?= ${SED} ${MOZ_SED_ARGS}
430 CONFIGURE_TARGET=x86_64-unknown-${OPSYS:tl}${OSREL}
431 . if ${USE_MOZILLA:M-nss}
432 USE_BINUTILS= # intel-gcm.s
433 CFLAGS+= -B${LOCALBASE}/bin
434 LDFLAGS+= -B${LOCALBASE}/bin
435 . if ${OSVERSION} < 1000041 && exists(/usr/lib/libcxxrt.so) && \
436 ${CXXFLAGS:M-stdlib=libc++}
440 .elif ${ARCH:Mpowerpc*}
442 CFLAGS+= -D__STDC_CONSTANT_MACROS
443 . if ${ARCH} == "powerpc64"
444 MOZ_EXPORT+= UNAME_m="${ARCH}"
445 CFLAGS+= -mminimal-toc
447 .elif ${ARCH} == "sparc64"
448 # Work around miscompilation/mislinkage of the sCanonicalVTable hacks.
449 MOZ_OPTIONS+= --disable-v1-string-abi
452 .if defined(OBJDIR_BUILD)
453 CONFIGURE_SCRIPT=../configure
455 MOZ_OBJDIR= ${WRKSRC}/obj-${CONFIGURE_TARGET}
456 CONFIGURE_WRKSRC=${MOZ_OBJDIR}
457 BUILD_WRKSRC= ${MOZ_OBJDIR}
458 INSTALL_WRKSRC= ${MOZ_OBJDIR}
460 MOZ_OBJDIR= ${WRKSRC}
463 .else # bsd.port.post.mk
465 pre-extract: gecko-pre-extract
468 .if ${PORT_OPTIONS:MPGO}
469 @${ECHO} "*****************************************************************"
470 @${ECHO} "**************************** attention **************************"
471 @${ECHO} "*****************************************************************"
472 @${ECHO} "To build ${MOZILLA} with PGO support you need a running X server and"
473 @${ECHO} " build this port with an user who could access the X server! "
475 @${ECHO} "During the build a ${MOZILLA} instance will start and run some test."
476 @${ECHO} " Do not interrupt or close ${MOZILLA} during this tests! "
477 @${ECHO} "*****************************************************************"
481 post-patch: gecko-post-patch gecko-moz-pis-patch
484 .if exists(${PKGINSTALL_INC})
485 @${MOZCONFIG_SED} < ${PKGINSTALL_INC} > ${PKGINSTALL}
487 .if exists(${PKGDEINSTALL_INC})
488 @${MOZCONFIG_SED} < ${PKGDEINSTALL_INC} > ${PKGDEINSTALL}
490 @${RM} -f ${MOZCONFIG}
491 .if !defined(NOMOZCONFIG)
492 @if [ -e ${PORT_MOZCONFIG} ] ; then \
493 ${MOZCONFIG_SED} < ${PORT_MOZCONFIG} >> ${MOZCONFIG} ; \
495 .for arg in ${MOZ_OPTIONS}
496 @${ECHO_CMD} ac_add_options ${arg:Q} >> ${MOZCONFIG}
498 .for arg in ${MOZ_MK_OPTIONS}
499 @${ECHO_CMD} mk_add_options ${arg:Q} >> ${MOZCONFIG}
501 .for var in ${MOZ_EXPORT}
502 @${ECHO_CMD} export ${var:Q} >> ${MOZCONFIG}
504 .endif # .if !defined(NOMOZCONFIG)
505 .if exists(${MOZSRC}/build/unix/mozilla-config.in)
506 @${REINPLACE_CMD} -e 's/%{idldir}/%idldir%/g ; \
507 s|"%FULL_NSPR_CFLAGS%"|`nspr-config --cflags`|g ; \
508 s|"%FULL_NSPR_LIBS%"|`nspr-config --libs`|g' \
509 ${MOZSRC}/build/unix/mozilla-config.in
511 .if ${USE_MOZILLA:M-nspr}
512 @${ECHO_MSG} "===> Applying NSPR patches"
513 @for i in ${.CURDIR}/../../devel/nspr/files/patch-*; do \
514 ${PATCH} ${PATCH_ARGS} -d ${MOZSRC}/nsprpub/build < $$i; \
517 .if ${USE_MOZILLA:M-nss}
518 @${ECHO_MSG} "===> Applying NSS patches"
519 @for i in ${.CURDIR}/../../security/nss/files/patch-*; do \
520 ${PATCH} ${PATCH_ARGS} -d ${MOZSRC}/security/nss < $$i; \
524 ${WRKSRC}/directory/c-sdk/config/FreeBSD.mk \
525 ${WRKSRC}/directory/c-sdk/configure \
526 ${MOZSRC}/security/coreconf/FreeBSD.mk \
527 ${MOZSRC}/js/src/Makefile.in \
528 ${MOZSRC}/js/src/configure \
529 ${MOZSRC}/configure \
530 ${WRKSRC}/configure; do \
531 if [ -f $$f ] ; then \
532 ${REINPLACE_CMD} -Ee 's|-lc_r|${PTHREAD_LIBS}|g ; \
533 s|-l?pthread|${PTHREAD_LIBS}|g ; \
534 s|echo aout|echo elf|g ; \
535 s|/usr/X11R6|${LOCALBASE}|g' \
539 @if [ -f ${WRKSRC}/config/baseconfig.mk ] ; then \
540 ${REINPLACE_CMD} -e 's|%%MOZILLA%%|${MOZILLA}|g' \
541 ${WRKSRC}/config/baseconfig.mk; \
543 ${REINPLACE_CMD} -e 's|%%MOZILLA%%|${MOZILLA}|g' \
544 ${WRKSRC}/config/autoconf.mk.in; \
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/src/mozHunspell.cpp
562 # handles mozilla pis scripts.
564 .for moz in ${MOZ_PIS_SCRIPTS}
565 @${MOZCONFIG_SED} < ${FILESDIR}/${moz} > ${WRKDIR}/${moz}
568 pre-configure: gecko-pre-configure
571 .if defined(OBJDIR_BUILD)
572 ${MKDIR} ${MOZ_OBJDIR}
575 post-configure: gecko-post-configure
577 gecko-post-configure:
578 @${ECHO_CMD} "#define JNIIMPORT" >> ${MOZSRC}/mozilla-config.h
580 pre-install: gecko-moz-pis-pre-install gecko-pre-install port-pre-install gecko-create-plist
582 .if !target(port-pre-install)
588 .if !defined(NOGECKO_PLIST)
589 @${RM} -rf ${FAKEDIR} ${PLIST} ${PLISTD} ${PLISTF}
590 @${TOUCH} -f ${PLIST} ${PLISTD} ${PLISTF}
591 @cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} \
592 ${MAKEFILE} ${MAKE_ARGS} prefix=${FAKEDIR} ${INSTALL_TARGET}
593 .if defined(MOZILLA_SUFX) && ${MOZILLA_SUFX}!="none"
594 ${MV} ${FAKEDIR}/bin/${MOZILLA_EXEC_NAME:S/${MOZILLA_SUFX}//} ${FAKEDIR}/bin/${MOZILLA}
595 .if exists(${FAKEDIR}/bin/${MOZILLA_EXEC_NAME:S/${MOZILLA_SUFX}//}-config)
596 ${MV} ${FAKEDIR}/bin/${MOZILLA_EXEC_NAME:S/${MOZILLA_SUFX}//}-config ${FAKEDIR}/bin/${MOZILLA}-config
598 .for pc in ${MOZ_PKGCONFIG_FILES:S|${MOZILLA_SUFX}||}
599 ${SED} -e 's|Requires: ${MOZILLA:S/${MOZILLA_SUFX}//}|Requires: ${MOZILLA}|' \
600 ${FAKEDIR}/lib/pkgconfig/${pc}.pc > ${FAKEDIR}/lib/pkgconfig/${pc:S/${MOZILLA:S,${MOZILLA_SUFX},,}/${MOZILLA}/}.pc
602 @${REINPLACE_CMD} -e 's|${MOZILLA_BIN}|${MOZILLA:S/${MOZILLA_SUFX}//}|; \
603 s|$${progbase}-bin|${MOZILLA:S/${MOZILLA_SUFX}//}-bin|' \
604 -e 's|${FAKEDIR}|${PREFIX}|g' \
605 -i '' $$(${REALPATH} ${FAKEDIR}/bin/${MOZILLA}*)
607 @${REINPLACE_CMD} -e 's|${FAKEDIR}|${PREFIX}|g' \
608 -i '' $$(${REALPATH} ${FAKEDIR}/bin/${MOZILLA_EXEC_NAME}*)
613 .if !defined(NOGECKO_PLIST)
615 .for f in ${GECKO_PLIST_PRE_FILES}
616 ${ECHO_CMD} ${f} >> ${PLISTF}
618 .for f in ${GECKO_PLIST_PRE_DIRS}
619 ${ECHO_CMD} "@dirrm ${f}" >> ${PLISTD}
621 ${MKDIR} ${FAKEDIR}/libdata
622 ${MV} -f ${FAKEDIR}/lib/pkgconfig ${FAKEDIR}/libdata/ || ${TRUE}
623 ${RM} -f ${FAKEDIR}/lib/pkgconfig
624 .for dir in ${MOZILLA_PLIST_DIRS}
625 @cd ${FAKEDIR}/${dir} && ${FIND} -H -s * ! -type d | \
626 ${SED} -e 's|^|${dir}/|' >> ${PLISTF} && \
627 ${FIND} -d * -type d | \
628 ${SED} -e 's|^|@dirrm ${dir}/|' >> ${PLISTD}
630 .for pcfile in ${MOZ_PKGCONFIG_FILES}
631 ${ECHO_CMD} "libdata/pkgconfig/${pcfile}.pc" >> ${PLISTF}
632 @${REINPLACE_CMD} -e 's|${FAKEDIR}|${PREFIX}|g' \
633 -e 's|${MOZILLA}-nspr = ${PORTVERSION}|nspr|' \
634 ${FAKEDIR}/libdata/pkgconfig/${pcfile}.pc
636 ${CAT} ${PLISTF} | ${SORT} >> ${PLIST}
637 ${CAT} ${PLISTD} | ${SORT} -r >> ${PLIST}
638 ${ECHO_CMD} "@exec ${LOCALBASE}/bin/update-desktop-database > /dev/null || ${TRUE}" >> ${PLIST}
639 ${ECHO_CMD} "@unexec ${LOCALBASE}/bin/update-desktop-database > /dev/null || ${TRUE}" >> ${PLIST}
640 .endif # !defined(NOGECKO_PLIST)
642 do-install: gecko-do-install
645 .if !defined(NOGECKO_INSTALL)
646 .for dir in ${MOZILLA_PLIST_DIRS}
647 .if !exists(${PREFIX}/${dir})
648 ${MKDIR} ${PREFIX}/${dir}
650 ${TAR} cf - -C${FAKEDIR}/${dir} -s'|${FAKEDIR}|${PREFIX}|s' . | \
651 ${TAR} xof - -C${PREFIX}/${dir}
653 .for pcfile in ${MOZ_PKGCONFIG_FILES}
654 ${INSTALL_DATA} ${FAKEDIR}/libdata/pkgconfig/${pcfile}.pc \
655 ${PREFIX}/libdata/pkgconfig/${pcfile}.pc
657 .endif # !defined(NOGECKO_INSTALL)
659 gecko-moz-pis-pre-install:
660 .if defined(MOZ_PIS_SCRIPTS)
661 ${MKDIR} ${FAKEDIR}/${MOZ_PIS_DIR}
662 .for moz in ${MOZ_PIS_SCRIPTS}
663 ${INSTALL_SCRIPT} ${WRKDIR}/${moz} ${FAKEDIR}/${MOZ_PIS_DIR}
667 post-install: gecko-post-install
670 .if !defined(PACKAGE_BUILDING) && !defined(NO_MOZPKGINSTALL)
671 @if [ -e ${PKGINSTALL} ] ; then \
672 ${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL; \
675 @-update-desktop-database
679 # HERE THERE BE TACOS -- adamw