Import security/amavis-stats version 0.1.12_3
[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.
37 #
38 # GECKO_PLIST_PRE_FILES Manual add files in the plist if it needs.
39 #
40 # GECKO_PLIST_PRE_DIRS  Manual directories in the plist if it needs.
41 #
42 # MOZILLA_PLIST_DIRS    List of directories to descend into when installing
43 #                                               and creating the plist
44 #
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)
48 #
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
52 #                                               than clobber it
53 #
54 # MOZ_OPTIONS                   configure arguments (added to .mozconfig). If
55 #                                               NOMOZCONFIG is defined, you probably want to set
56 #                                               CONFIGURE_ARGS+=${MOZ_OPTIONS}
57 #
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}
61 #
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}
65 #
66 # MOZ_CHROME                    A variable for the --enable-chrome-format= in
67 #                                               CONFIGURE_ARGS. The default is omni.
68 #
69 # MOZ_TOOLKIT                   A variable for the --enable-default-toolkit= in
70 #                                               CONFIGURE_ARGS. The default is cairo-gtk2.
71 #
72 # MOZ_EXTENSIONS                A list of extensions to build
73 #
74 # MOZ_PROTOCOLS                 A list of protocols to build (http, ftp, etc.)
75 #
76 # PORT_MOZCONFIG                Defaults to ${FILESDIR}/mozconfig.in, but can be
77 #                                               set to a generic mozconfig included with the port
78 #
79 # NOGECKO_INSTALL               Don't install the built gecko (most likely for
80 #                                               testing)
81 #
82 # NOGECKO_PLIST                 Don't create a dynamically-generated playlist
83 #
84 # NOMOZCONFIG                   Don't drop a customized .mozconfig into the build
85 #                                               directory. Options will have to be specified in
86 #                                               CONFIGURE_ARGS instead
87 #
88
89 MAINTAINER?=    gecko@FreeBSD.org
90
91 MOZILLA?=       ${PORTNAME}
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
98 USE_PERL5=      build
99 USE_XORG=       xext xrender xt
100
101 NO_STAGE=       yes
102
103 MOZILLA_SUFX?=  none
104 MOZSRC?=        ${WRKSRC}
105 WRKSRC?=        ${WRKDIR}/mozilla
106 FAKEDIR?=       ${WRKDIR}/fake
107 PLIST?=         ${WRKDIR}/plist
108 PLISTD?=        ${WRKDIR}/plist_dirs
109 PLISTF?=        ${WRKDIR}/plist_files
110
111 MOZ_PIS_DIR?=           lib/${MOZILLA}/init.d
112
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
120
121 EXTRACT_AFTER_ARGS?=    --exclude */CVS/*       \
122                         --exclude */macbuild/*                  \
123                         --exclude */package/*                   \
124                         --exclude mozilla*/gc/boehm
125
126 MOZ_PKGCONFIG_FILES?=   ${MOZILLA}-gtkmozembed ${MOZILLA}-js \
127                         ${MOZILLA}-xpcom ${MOZILLA}-plugin
128
129 MOZ_EXPORT+=    ${CONFIGURE_ENV} \
130                                 LIBS="${LIBS}" PERL="${PERL}"
131 MOZ_OPTIONS+=   --prefix="${FAKEDIR}"
132
133 CPPFLAGS+=              -isystem${LOCALBASE}/include
134 LDFLAGS+=               -L${LOCALBASE}/lib -Wl,-rpath,${PREFIX}/lib/${MOZILLA}
135
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
140 .endif
141
142 # Standard depends
143 _ALL_DEPENDS=   cairo event ffi harfbuzz hunspell icu jpeg nspr nss opus png pixman sqlite vorbis vpx
144
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
148
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
152
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
156
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
162 .endif
163
164 hunspell_LIB_DEPENDS=   libhunspell-1.3.so:${PORTSDIR}/textproc/hunspell
165 hunspell_MOZ_OPTIONS=   --enable-system-hunspell
166
167 icu_LIB_DEPENDS=                libicui18n.so:${PORTSDIR}/devel/icu
168 icu_MOZ_OPTIONS=                --with-system-icu --with-intl-api --enable-intl-api
169
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
176
177 nspr_LIB_DEPENDS=       libnspr4.so:${PORTSDIR}/devel/nspr
178 nspr_MOZ_OPTIONS=       --with-system-nspr
179
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
185
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
190 .endif
191
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
195
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
199
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
203
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
209 .endif
210
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
215
216 .for use in ${USE_MOZILLA}
217 ${use:S/-/_WITHOUT_/}=  ${TRUE}
218 .endfor
219
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}
227 .else
228 BUILD_DEPENDS+= ${-${dep}_BUILD_DEPENDS}
229 .endif
230 .endfor
231
232 # Standard options
233 MOZ_CHROME?=    omni
234 MOZ_TOOLKIT?=   cairo-gtk2
235 MOZ_OPTIONS+=   \
236                 --enable-chrome-format=${MOZ_CHROME} \
237                 --enable-default-toolkit=${MOZ_TOOLKIT} \
238                 --with-pthreads
239 # Configure options for install
240 .if !defined(MOZ_EXTENSIONS)
241 MOZ_OPTIONS+=   --enable-extensions=default
242 .else
243 MOZ_OPTIONS+=   --enable-extensions=${MOZ_EXTENSIONS}
244 .endif
245 .if !defined(MOZ_PROTOCOLS)
246 MOZ_OPTIONS+=   --enable-necko-protocols=default
247 .else
248 MOZ_OPTIONS+=   --enable-necko-protocols=${MOZ_PROTOCOLS}
249 .endif
250 # others
251 MOZ_OPTIONS+=   --with-system-zlib              \
252                 --with-system-bz2               \
253                 --enable-unified-compilation    \
254                 --disable-debug-symbols         \
255                 --disable-glibtest              \
256                 --disable-gtktest               \
257                 --disable-freetypetest          \
258                 --disable-installer             \
259                 --disable-updater               \
260                 --disable-pedantic
261
262 # XXX stolen from www/chromium
263 MOZ_EXPORT+=    MOZ_GOOGLE_API_KEY=AIzaSyBsp9n41JLW8jCokwn7vhoaMejDFRd1mp8
264
265 .if ${PORT_OPTIONS:MGTK3}
266 MOZ_TOOLKIT=    cairo-gtk3
267 .endif
268
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
273 USE_GNOME+=     pango
274 . if ${MOZILLA_VER:R:R} >= 30
275 USE_QT5+=       qmake_build buildtools_build gui network quick printsupport
276 . else
277 USE_QT4+=       qmake_build moc_build rcc_build gui network opengl
278 . endif
279 MOZ_EXPORT+=    HOST_QMAKE="${QMAKE}" HOST_MOC="${MOC}" HOST_RCC="${RCC}"
280 .elif ${MOZ_TOOLKIT:Mcairo-gtk3}
281 USE_GNOME+=     gtk30
282 .else # gtk2, cairo-gtk2
283 USE_GNOME+=     gtk20
284 .endif
285
286 .if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
287 CFLAGS+=                -O3
288 MOZ_EXPORT+=    MOZ_OPTIMIZE_FLAGS="${CFLAGS:M-O*}"
289 MOZ_OPTIONS+=   --enable-optimize
290 .else
291 MOZ_OPTIONS+=   --disable-optimize
292 .endif
293
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
299 .else
300 MOZ_OPTIONS+=   --disable-dbus --disable-libnotify
301 .endif
302
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
307 . else
308 USE_GSTREAMER?= good ffmpeg
309 MOZ_OPTIONS+=   --enable-gstreamer
310 . endif
311 .else
312 MOZ_OPTIONS+=   --disable-gstreamer
313 .endif
314
315 .if ${PORT_OPTIONS:MGCONF}
316 BUILD_DEPENDS+= ${gconf2_DETECT}:${gconf2_LIB_DEPENDS:C/.*://}
317 USE_GNOME+=             gconf2:build
318 MOZ_OPTIONS+=   --enable-gconf
319 .else
320 MOZ_OPTIONS+=   --disable-gconf
321 .endif
322
323 .if ${PORT_OPTIONS:MGIO} && ! ${MOZ_TOOLKIT:Mcairo-qt}
324 MOZ_OPTIONS+=   --enable-gio
325 .else
326 MOZ_OPTIONS+=   --disable-gio
327 .endif
328
329 .if ${PORT_OPTIONS:MGNOMEUI}
330 BUILD_DEPENDS+= ${libgnomeui_DETECT}:${libgnomeui_LIB_DEPENDS:C/.*://}
331 USE_GNOME+=             libgnomeui:build
332 MOZ_OPTIONS+=   --enable-gnomeui
333 .else
334 MOZ_OPTIONS+=   --disable-gnomeui
335 .endif
336
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/}
342 .else
343 MOZ_OPTIONS+=   --disable-gnomevfs
344 .endif
345
346 .if ${PORT_OPTIONS:MLIBPROXY}
347 LIB_DEPENDS+=   libproxy.so:${PORTSDIR}/net/libproxy
348 MOZ_OPTIONS+=   --enable-libproxy
349 .else
350 MOZ_OPTIONS+=   --disable-libproxy
351 .endif
352
353 .if ${PORT_OPTIONS:MPGO}
354 USE_GCC?=       yes
355 USE_DISPLAY=yes
356
357 .undef GNU_CONFIGURE
358 MAKEFILE=       ${WRKSRC}/client.mk
359 ALL_TARGET=     profiledbuild
360 MOZ_EXPORT+=MOZ_OPTIMIZE_FLAGS="-Os" MOZ_PGO_OPTIMIZE_FLAGS="${CFLAGS:M-O*}"
361 .endif
362
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
367 .endif
368
369 .if ${PORT_OPTIONS:MPULSEAUDIO}
370 BUILD_DEPENDS+= pulseaudio>0:${PORTSDIR}/audio/pulseaudio
371 MOZ_OPTIONS+=   --enable-pulseaudio
372 .else
373 MOZ_OPTIONS+=   --disable-pulseaudio
374 .endif
375
376 .if ${PORT_OPTIONS:MDEBUG}
377 MOZ_OPTIONS+=   --enable-debug --disable-release
378 STRIP=  # ports/184285
379 .else
380 MOZ_OPTIONS+=   --disable-debug --enable-release
381 .endif
382
383 .if ${PORT_OPTIONS:MLOGGING} || ${PORT_OPTIONS:MDEBUG}
384 MOZ_OPTIONS+=   --enable-logging
385 .else
386 MOZ_OPTIONS+=   --disable-logging
387 .endif
388
389 .if ${PORT_OPTIONS:MPROFILE}
390 MOZ_OPTIONS+=   --enable-profiling
391 STRIP=
392 .else
393 MOZ_OPTIONS+=   --disable-profiling
394 .endif
395
396 .if ${PORT_OPTIONS:MTEST}
397 USE_XORG+=              xscrnsaver
398 MOZ_OPTIONS+=   --enable-tests
399 .else
400 MOZ_OPTIONS+=   --disable-tests
401 .endif
402
403 .if !defined(STRIP) || ${STRIP} == ""
404 MOZ_OPTIONS+=   --disable-strip --disable-install-strip
405 .else
406 MOZ_OPTIONS+=   --enable-strip --enable-install-strip
407 .endif
408
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}
428
429 .if ${ARCH} == amd64
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++}
437 LIBS+=          -lcxxrt
438 .  endif
439 . endif
440 .elif ${ARCH:Mpowerpc*}
441 USE_GCC?=       yes
442 CFLAGS+=        -D__STDC_CONSTANT_MACROS
443 . if ${ARCH} == "powerpc64"
444 MOZ_EXPORT+=    UNAME_m="${ARCH}"
445 CFLAGS+=        -mminimal-toc
446 . endif
447 .elif ${ARCH} == "sparc64"
448 # Work around miscompilation/mislinkage of the sCanonicalVTable hacks.
449 MOZ_OPTIONS+=   --disable-v1-string-abi
450 .endif
451
452 .if defined(OBJDIR_BUILD)
453 CONFIGURE_SCRIPT=../configure
454
455 MOZ_OBJDIR=             ${WRKSRC}/obj-${CONFIGURE_TARGET}
456 CONFIGURE_WRKSRC=${MOZ_OBJDIR}
457 BUILD_WRKSRC=   ${MOZ_OBJDIR}
458 INSTALL_WRKSRC= ${MOZ_OBJDIR}
459 .else
460 MOZ_OBJDIR=             ${WRKSRC}
461 .endif
462
463 .else # bsd.port.post.mk
464
465 pre-extract: gecko-pre-extract
466
467 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!   "
474         @${ECHO} ""
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} "*****************************************************************"
478         @sleep 10
479 .endif
480
481 post-patch: gecko-post-patch gecko-moz-pis-patch
482
483 gecko-post-patch:
484 .if exists(${PKGINSTALL_INC})
485         @${MOZCONFIG_SED} < ${PKGINSTALL_INC} > ${PKGINSTALL}
486 .endif
487 .if exists(${PKGDEINSTALL_INC})
488         @${MOZCONFIG_SED} < ${PKGDEINSTALL_INC} > ${PKGDEINSTALL}
489 .endif
490         @${RM} -f ${MOZCONFIG}
491 .if !defined(NOMOZCONFIG)
492         @if [ -e ${PORT_MOZCONFIG} ] ; then \
493                 ${MOZCONFIG_SED} < ${PORT_MOZCONFIG} >> ${MOZCONFIG} ; \
494         fi
495 .for arg in ${MOZ_OPTIONS}
496         @${ECHO_CMD} ac_add_options ${arg:Q} >> ${MOZCONFIG}
497 .endfor
498 .for arg in ${MOZ_MK_OPTIONS}
499         @${ECHO_CMD} mk_add_options ${arg:Q} >> ${MOZCONFIG}
500 .endfor
501 .for var in ${MOZ_EXPORT}
502         @${ECHO_CMD} export ${var:Q} >> ${MOZCONFIG}
503 .endfor
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
510 .endif
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; \
515         done
516 .endif
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; \
521         done
522 .endif
523         @for f in \
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' \
536                                 $$f; \
537                 fi; \
538         done
539         @if [ -f ${WRKSRC}/config/baseconfig.mk ] ; then \
540                 ${REINPLACE_CMD} -e 's|%%MOZILLA%%|${MOZILLA}|g' \
541                         ${WRKSRC}/config/baseconfig.mk; \
542         else \
543                 ${REINPLACE_CMD} -e 's|%%MOZILLA%%|${MOZILLA}|g' \
544                         ${WRKSRC}/config/autoconf.mk.in; \
545         fi
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
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-configure: gecko-pre-configure
569
570 gecko-pre-configure:
571 .if defined(OBJDIR_BUILD)
572         ${MKDIR} ${MOZ_OBJDIR}
573 .endif
574
575 post-configure: gecko-post-configure
576
577 gecko-post-configure:
578         @${ECHO_CMD} "#define JNIIMPORT" >> ${MOZSRC}/mozilla-config.h
579
580 pre-install: gecko-moz-pis-pre-install gecko-pre-install port-pre-install gecko-create-plist
581
582 .if !target(port-pre-install)
583 port-pre-install:
584                 @${DO_NADA}
585 .endif
586
587 gecko-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
597 .endif
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
601 .endfor
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}*)
606 .else
607         @${REINPLACE_CMD} -e 's|${FAKEDIR}|${PREFIX}|g' \
608                 -i '' $$(${REALPATH} ${FAKEDIR}/bin/${MOZILLA_EXEC_NAME}*)
609 .endif
610 .endif
611
612 gecko-create-plist:
613 .if !defined(NOGECKO_PLIST)
614 # Create the plist
615 .for f in ${GECKO_PLIST_PRE_FILES}
616         ${ECHO_CMD} ${f} >> ${PLISTF}
617 .endfor
618 .for f in ${GECKO_PLIST_PRE_DIRS}
619         ${ECHO_CMD} "@dirrm ${f}" >> ${PLISTD}
620 .endfor
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}
629 .endfor
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
635 .endfor
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)
641
642 do-install: gecko-do-install
643
644 gecko-do-install:
645 .if !defined(NOGECKO_INSTALL)
646 .for dir in ${MOZILLA_PLIST_DIRS}
647 .if !exists(${PREFIX}/${dir})
648         ${MKDIR} ${PREFIX}/${dir}
649 .endif
650         ${TAR} cf - -C${FAKEDIR}/${dir} -s'|${FAKEDIR}|${PREFIX}|s' . | \
651                 ${TAR} xof - -C${PREFIX}/${dir}
652 .endfor
653 .for pcfile in ${MOZ_PKGCONFIG_FILES}
654         ${INSTALL_DATA} ${FAKEDIR}/libdata/pkgconfig/${pcfile}.pc \
655                 ${PREFIX}/libdata/pkgconfig/${pcfile}.pc
656 .endfor
657 .endif # !defined(NOGECKO_INSTALL)
658
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}
664 .endfor
665 .endif
666
667 post-install: gecko-post-install
668
669 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; \
673         fi
674 .endif
675         @-update-desktop-database
676
677 .endif
678 .endif
679 # HERE THERE BE TACOS -- adamw