component(developer/golang-123): Add Component
[oi-userland.git] / components / web / firefox / Makefile
blob1f5b24eebcd81b4e65e367d4fb8783144aca9029
2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
5 # 1.0 of the CDDL.
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
13 # Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
14 # Copyright 2015 OpenSXCE.org Martin Bochnig <opensxce@mail.ru>
15 # Copyright 2013-2017 Alexander Pyhalov
16 # Copyright 2019 Geoffrey Weiss
17 # Copyright 2019 Michal Nowak
18 # Copyright 2021 Carsten Grzemba
21 USE_PARALLEL_BUILD = yes
22 include ../../../make-rules/shared-macros.mk
23 ENV = /usr/bin/env
25 # ESR should be set to esr for esr build, or an empty string for other builds
26 ESR =
28 # CANDIDATE_BUILD is the build number found in the candidates directory.
29 # CANDIDATE_BETA is the beta version found in the candidates directory.
30 # CANDIDATE_NIGHTLY is the nightly release hosted on github
31 # USE_HG_REPO is to use mozilla's hg source repo nstead of github
32 # Do not define any for final release build.
33 # CANDIDATE_BUILD=1
34 # CANDIDATE_BETA=9
35 # CANDIDATE_NIGHTLY=1
36 # USE_HG_REPO=1
38 COMPONENT_NAME = firefox
39 COMPONENT_VERSION = 133.0.3
40 COMPONENT_SUMMARY= Mozilla Firefox Web browser
41 COMPONENT_PROJECT_URL = https://www.mozilla.com/firefox
42 COMPONENT_SRC_NAME = $(COMPONENT_NAME)-$(COMPONENT_VERSION)
44 ifdef CANDIDATE_BETA
45 COMPONENT_ARCHIVE = $(COMPONENT_NAME)-$(COMPONENT_VERSION)b$(CANDIDATE_BETA)$(ESR).source.tar.xz
46 else
47 COMPONENT_ARCHIVE = $(COMPONENT_SRC_NAME)$(ESR).source.tar.xz
48 # CANDIDATE_BETA
49 endif
51 ifdef CANDIDATE_NIGHTLY
52 COMPONENT_GIT_HASH= 4f44c14a73993e4490646bde47eacbf2b9d267aa
53 COMPONENT_SRC= gecko-dev-$(COMPONENT_GIT_HASH)
54 COMPONENT_ARCHIVE= $(COMPONENT_GIT_HASH).tar.gz
55 COMPONENT_ARCHIVE_URL= https://github.com/mozilla/gecko-dev/archive/$(COMPONENT_ARCHIVE)
56 ifdef USE_HG_REPO
57 COMPONENT_HG_HASH= ff0882e981495f07c521e0b00e1e83b050dfcdc2
58 COMPONENT_SRC= mozilla-central-$(COMPONENT_HG_HASH)
59 COMPONENT_ARCHIVE= $(COMPONENT_HG_HASH).zip
60 COMPONENT_ARCHIVE_URL= https://hg.mozilla.org/mozilla-central/archive/$(COMPONENT_ARCHIVE)
61 endif
62 else
63 ifndef CANDIDATE_BUILD
64 MOZILLA_FTP = https://ftp.mozilla.org/pub/$(COMPONENT_NAME)/releases/$(COMPONENT_VERSION)$(ESR)
65 else
66 ifndef CANDIDATE_BETA
67 MOZILLA_FTP = https://ftp.mozilla.org/pub/$(COMPONENT_NAME)/candidates/$(COMPONENT_VERSION)$(ESR)-candidates/build$(CANDIDATE_BUILD)
68 else
69 MOZILLA_FTP = https://ftp.mozilla.org/pub/$(COMPONENT_NAME)/candidates/$(COMPONENT_VERSION)b$(CANDIDATE_BETA)$(ESR)-candidates/build$(CANDIDATE_BUILD)
70 endif
71 endif
72 COMPONENT_SRC = $(COMPONENT_SRC_NAME)
73 COMPONENT_ARCHIVE_URL = $(MOZILLA_FTP)/source/$(COMPONENT_ARCHIVE)
74 endif
76 COMPONENT_ARCHIVE_HASH= sha256:f134a5420200bb03ab460f9d2867507c0edb222ce73faf4064cdbea02a0aca1b
77 COMPONENT_PROJECT_URL = https://www.mozilla.com/en-US/firefox/
78 COMPONENT_FMRI= web/browser/firefox
80 RUST_VERSION = 1.82.0
82 # TODO: use remote hashfile to verify
83 ALLOW_UNVERIFIED_DOWNLOADS=yes
84 export ALLOW_UNVERIFIED_DOWNLOADS
86 LANG_LIST= ach af an ar ast az be bg bn br bs ca-valencia ca cak cs cy da de dsb el en-CA en-GB \
87 en-US eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fur fy-NL ga-IE gd gl gn gu-IN he hi-IN hr hsb \
88 hu hy-AM ia id is it ja ka kab kk km kn ko lij lt lv mk mr ms my nb-NO ne-NP nl nn-NO oc pa-IN \
89 pl pt-BR pt-PT rm ro ru sat sc sco si sk skr sl son sq sr sv-SE szl ta te tg th tl tr trs uk ur uz vi xh zh-CN zh-TW
91 ifdef CANDIDATE_NIGHTLY
92 FIREFOX_UPDATE_CHANNEL=nightly
93 else
94 ifdef CANDIDATE_BETA
95 LANG_FILES_LOCATION= \
96 https://ftp.mozilla.org/pub/firefox/candidates/$(COMPONENT_VERSION)b$(CANDIDATE_BETA)$(ESR)-candidates/build$(CANDIDATE_BUILD)/linux-x86_64/xpi
97 FIREFOX_UPDATE_CHANNEL=beta
98 else
99 ifdef CANDIDATE_BUILD
100 LANG_FILES_LOCATION= \
101 https://ftp.mozilla.org/pub/firefox/candidates/$(COMPONENT_VERSION)$(ESR)-candidates/build$(CANDIDATE_BUILD)/linux-x86_64/xpi
102 FIREFOX_UPDATE_CHANNEL=default
103 else
104 LANG_FILES_LOCATION= \
105 https://ftp.mozilla.org/pub/firefox/releases/$(COMPONENT_VERSION)$(ESR)/linux-x86_64/xpi
106 FIREFOX_UPDATE_CHANNEL=default
107 endif
108 endif
109 endif
111 # handle esr case to set FIREFOX_UPDATE_CHANNEL
112 ifdef ESR
113 ifeq ($(ESR), esr)
114 FIREFOX_UPDATE_CHANNEL=esr
115 endif
116 endif
118 CONFIGURE_DEFAULT_DIRS=no
120 include $(WS_MAKE_RULES)/common.mk
122 RUSTUP_HOME = $(BUILD_DIR)/.rust_up
123 CARGO_HOME = $(BUILD_DIR)/.cargo
125 PATH = $(CARGO_HOME)/bin:$(PATH.gnu)
127 MOZCONFIG = $(SOURCE_DIR)/mozconfig
128 GNU_ARCH= x86_64-unknown-illumos
130 ifdef DEBUG
131 # disable code optimization
132 CFLAGS =
133 CXXFLAGS =
135 MOZCONFIG_DEBUG = $(MOZCONFIG)
136 MOZCONFIG_NON_DEBUG = /dev/null
137 else
138 MOZCONFIG_DEBUG = /dev/null
139 MOZCONFIG_NON_DEBUG = $(MOZCONFIG)
140 endif
142 CONFIGURE_ENV=
143 CONFIGURE_OPTIONS=
145 # clang or gcc
146 CC_TYPE = gcc
147 COMPILER.gcc= gcc
148 COMPILER.clang= clang
149 COMPILER = $(COMPILER.$(CC_TYPE))
151 CXXFLAGS += -Wno-invalid-offsetof -fpermissive
152 # xpcom uses DEF XP_SOLARIS
153 CXXFLAGS += -DXP_SOLARIS
154 # type problem compiling ffvpx with clang
155 CFLAGS += -D__int8_t_defined
157 FIREFOX_LIBDIR = $(CONFIGURE_LIBDIR.$(BITS))
159 COMPONENT_PRE_CONFIGURE_ACTION += \
160 rm -f $(MOZCONFIG); \
161 echo "ac_add_options MOZILLA_OFFICIAL=1" >> $(MOZCONFIG) ; \
162 echo "ac_add_options PKG_CONFIG=/usr/bin/amd64/pkg-config" >> $(MOZCONFIG) ; \
163 echo "ac_add_options CC_TYPE=$(CC_TYPE)" >> $(MOZCONFIG) ; \
164 echo "ac_add_options CC=$(CC)" >> $(MOZCONFIG) ; \
165 echo "ac_add_options CXX=$(CXX)" >> $(MOZCONFIG) ; \
166 echo "ac_add_options --prefix=/usr" >> $(MOZCONFIG) ; \
167 echo "ac_add_options --libdir=$(FIREFOX_LIBDIR)" >> $(MOZCONFIG) ; \
168 echo "ac_add_options --disable-crashreporter" >> $(MOZCONFIG) ; \
169 echo "ac_add_options --disable-debug-symbols" >> $(MOZCONFIG_NON_DEBUG) ; \
170 echo "ac_add_options --disable-install-strip" >> $(MOZCONFIG_DEBUG) ; \
171 echo "ac_add_options --disable-optimize" >> $(MOZCONFIG_DEBUG) ; \
172 echo "ac_add_options --disable-tests" >> $(MOZCONFIG) ; \
173 echo "ac_add_options --disable-updater" >> $(MOZCONFIG) ; \
174 echo "ac_add_options --enable-debug" >> $(MOZCONFIG_DEBUG) ; \
175 echo "ac_add_options --enable-jemalloc" >> $(MOZCONFIG) ; \
176 echo "ac_add_options --enable-js-shell" >> $(MOZCONFIG) ; \
177 echo "ac_add_options --enable-official-branding" >> $(MOZCONFIG) ; \
178 echo "ac_add_options --enable-optimize" >> $(MOZCONFIG_NON_DEBUG) ; \
179 echo "ac_add_options --enable-pulseaudio" >> $(MOZCONFIG) ; \
180 echo "ac_add_options --enable-replace-malloc" >> $(MOZCONFIG) ; \
181 echo "ac_add_options --enable-system-pixman" >> $(MOZCONFIG) ; \
182 echo "ac_add_options --enable-update-channel=$(FIREFOX_UPDATE_CHANNEL)" >> $(MOZCONFIG) ; \
183 echo "ac_add_options --with-distribution-id=org.openindiana" >> $(MOZCONFIG) ; \
184 echo "ac_add_options --with-intl-api" >> $(MOZCONFIG) ; \
185 echo "ac_add_options --with-system-zlib" >> $(MOZCONFIG) ; \
186 echo "ac_add_options --host=$(GNU_ARCH)" >> $(MOZCONFIG) ; \
187 echo "ac_add_options --target=$(GNU_ARCH)" >> $(MOZCONFIG) ; \
188 echo "ac_add_options --without-wasm-sandboxed-libraries" >> $(MOZCONFIG) ; \
189 # echo "ac_add_options --enable-bootstrap" >> $(MOZCONFIG) ; \
190 # echo "ac_add_options --with-wasi-sysroot=" >> $(MOZCONFIG) ; \
192 LD_SECEXT_OPTIONS += $(SSBD_ENABLE)
194 # 28395728
195 LD_MAP_NOEXBSS.sparc=
197 # libmozgtk needs to link to gtk3 and others
198 LD_Z_IGNORE=
200 # missing symbols from gtk3 during Firefox start
201 # LD_B_DIRECT=
203 # hope to get args data in stacks of core dumps
204 LD_OPTIONS += -msave-args
206 # use a local installed rust since the system version may not be compatible
207 COMPONENT_PRE_CONFIGURE_ACTION += ( \
208 export RUSTUP_HOME=$(RUSTUP_HOME); \
209 export CARGO_HOME=$(CARGO_HOME); \
210 export RUSTUP_INIT_SKIP_PATH_CHECK=yes; \
211 curl https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path; \
212 source $(CARGO_HOME)/env; \
213 rustup install $(RUST_VERSION); \
214 rustup default $(RUST_VERSION)-x86_64-unknown-illumos; \
215 rustup show; \
216 cargo install --root=$(CARGO_HOME) --vers 0.26.0 cbindgen; \
219 ENV += CFLAGS="$(CFLAGS)"
220 ENV += CXXFLAGS="$(CXXFLAGS)"
221 ENV += PKG_CONFIG=/usr/bin/amd64/pkg-config
222 ENV += RUSTUP_HOME=$(RUSTUP_HOME)
223 ENV += CARGO_HOME=$(CARGO_HOME)
225 COMPONENT_BUILD_ARGS += $(JOBS:%=-j%)
227 CONFIGURE_ENV = $(ENV)
228 COMPONENT_BUILD_ENV = $(ENV)
229 COMPONENT_INSTALL_ENV += HOME=/tmp
231 # language support is more complex on nightly release, support on beta and later
232 ifndef CANDIDATE_NIGHTLY
233 LANG_FILES=$(addsuffix .xpi,$(LANG_LIST))
235 CLEAN_PATHS += $(LANG_FILES)
237 $(LANG_FILES):
238 $(FETCH) --file $@ --url $(LANG_FILES_LOCATION)/$@
240 download prep:: $(LANG_FILES)
241 endif
243 COMPONENT_POST_BUILD_ACTION = \
244 (cd $(@D)/browser/installer ; $(ENV) $(COMPONENT_BUILD_ENV) \
245 $(GMAKE) $(COMPONENT_BUILD_ARGS) $(COMPONENT_BUILD_TARGETS))
247 COMPONENT_POST_INSTALL_ACTION = \
248 for file in `find $(PROTO_DIR)$(FIREFOX_LIBDIR)/firefox/ -name "*.so"`; do \
249 /usr/bin/elfedit -e 'dyn:value -s RUNPATH "$(GCC_LIBDIR):$(FIREFOX_LIBDIR)/firefox:/usr/lib/mps/amd64"' $$file ; \
250 /usr/bin/elfedit -e 'dyn:value -s RPATH "$(GCC_LIBDIR):$(FIREFOX_LIBDIR)/firefox:/usr/lib/mps/amd64"' $$file ; \
251 done ; \
252 mkdir $(PROTO_DIR)$(FIREFOX_LIBDIR)/firefox/distribution ; \
253 $(CP) $(COMPONENT_DIR)/files/distribution.ini $(PROTO_DIR)$(FIREFOX_LIBDIR)/firefox/distribution/distribution.ini ; \
254 unzip -c $(PROTOUSRLIBDIR64)/$(COMPONENT_NAME)/omni.ja chrome/toolkit/content/global/license.html \
255 | LC_ALL=en_US.UTF-8 lynx --display_charset=utf-8 -stdin --dump -nolist > $(COMPONENT_NAME).license ;
257 COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-$(MACH).master
259 COMPONENT_TEST_DIR = $(@D)/js/src
260 COMPONENT_TEST_TARGETS=check-jit-test
261 COMPONENT_TEST_TRANSFORMS = \
262 '-e "/^PASSED ALL/,/Failed:/p" ' \
263 '-e "/^FAILURES:/,/Failed:/p" ' \
264 '-e "/.*/d" '
266 # the license file is dynamically build, thus we need to remove it:
267 clean::
268 $(RM) $(COMPONENT_LICENSE_FILE)
270 # Build dependencies
271 PYTHON_REQUIRED_PACKAGES += library/python/psutil
272 PYTHON_REQUIRED_PACKAGES += runtime/python
273 REQUIRED_PACKAGES += database/sqlite-3
274 REQUIRED_PACKAGES += developer/build/autoconf-213
275 REQUIRED_PACKAGES += developer/lang/rustc
276 REQUIRED_PACKAGES += gnome/config/gconf
277 REQUIRED_PACKAGES += library/audio/pulseaudio
278 REQUIRED_PACKAGES += library/http-parser
279 REQUIRED_PACKAGES += runtime/nodejs-22
280 REQUIRED_PACKAGES += system/header/header-audio
281 REQUIRED_PACKAGES += web/browser/lynx
283 # Auto-generated dependencies
284 REQUIRED_PACKAGES += $(GCC_RUNTIME_PKG)
285 REQUIRED_PACKAGES += $(GXX_RUNTIME_PKG)
286 REQUIRED_PACKAGES += gnome/accessibility/at-spi2-core
287 REQUIRED_PACKAGES += library/c++/harfbuzz
288 REQUIRED_PACKAGES += library/desktop/cairo
289 REQUIRED_PACKAGES += library/desktop/gdk-pixbuf
290 REQUIRED_PACKAGES += library/desktop/gtk3
291 REQUIRED_PACKAGES += library/desktop/pango
292 REQUIRED_PACKAGES += library/glib2
293 REQUIRED_PACKAGES += library/graphics/pixman
294 REQUIRED_PACKAGES += library/zlib
295 REQUIRED_PACKAGES += system/library
296 REQUIRED_PACKAGES += system/library/fontconfig
297 REQUIRED_PACKAGES += system/library/freetype-2
298 REQUIRED_PACKAGES += system/library/libdbus
299 REQUIRED_PACKAGES += system/library/math
300 REQUIRED_PACKAGES += x11/library/libx11
301 REQUIRED_PACKAGES += x11/library/libxcb
302 REQUIRED_PACKAGES += x11/library/libxext
303 REQUIRED_PACKAGES += x11/library/libxrandr