Wed Nov 11 22:21:33 2020 UTC ()
firefox: Honor user's compiler choice again, don't require Python 2.

The python 2 dependency was seemingly removed in Firefox 78.0 so we
can remove those old hacks.

Firefox needs clang for some unknown part of the build process (rust
related?), even if building with GCC.

The previous solution in pkgsrc was to force the use of clang, because
pkgsrc provides cwrappers which provided gcc-as-clang, which broke
everything. Instead, override the clang wrapper with the actual clang
executable.

This means the majority of the build happens with GCC (or ccache, distcc,
whatever the user chooses, rather than overriding it with clang). Should help
sparc64, where clang doesn't work too well.

Full build tested on NetBSD/amd64.


(nia)
diff -r1.457 -r1.458 pkgsrc/www/firefox/Makefile
diff -r1.184 -r1.185 pkgsrc/www/firefox/mozilla-common.mk

cvs diff -r1.457 -r1.458 pkgsrc/www/firefox/Makefile (expand / switch to unified diff)

--- pkgsrc/www/firefox/Makefile 2020/11/11 10:11:21 1.457
+++ pkgsrc/www/firefox/Makefile 2020/11/11 22:21:33 1.458
@@ -1,22 +1,22 @@ @@ -1,22 +1,22 @@
1# $NetBSD: Makefile,v 1.457 2020/11/11 10:11:21 nia Exp $ 1# $NetBSD: Makefile,v 1.458 2020/11/11 22:21:33 nia Exp $
2 2
3FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR} 3FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
4MOZ_BRANCH= 82.0 4MOZ_BRANCH= 82.0
5MOZ_BRANCH_MINOR= .3 5MOZ_BRANCH_MINOR= .3
6 6
7DISTNAME= firefox-${FIREFOX_VER}.source 7DISTNAME= firefox-${FIREFOX_VER}.source
8PKGNAME= ${DISTNAME:S/.source//:S/b/beta/:S/esr//} 8PKGNAME= ${DISTNAME:S/.source//:S/b/beta/:S/esr//}
9#PKGREVISION= 1 9PKGREVISION= 1
10CATEGORIES= www 10CATEGORIES= www
11MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/} 11MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
12EXTRACT_SUFX= .tar.xz 12EXTRACT_SUFX= .tar.xz
13 13
14MAINTAINER= ryoon@NetBSD.org 14MAINTAINER= ryoon@NetBSD.org
15HOMEPAGE= https://www.mozilla.org/en-US/firefox/ 15HOMEPAGE= https://www.mozilla.org/en-US/firefox/
16COMMENT= Web browser with support for extensions (version ${FIREFOX_VER:tu:C/\\.[[:digit:]\.]*//}) 16COMMENT= Web browser with support for extensions (version ${FIREFOX_VER:tu:C/\\.[[:digit:]\.]*//})
17LICENSE= mpl-1.1 17LICENSE= mpl-1.1
18 18
19UNLIMIT_RESOURCES+= datasize virtualsize 19UNLIMIT_RESOURCES+= datasize virtualsize
20 20
21WRKSRC= ${WRKDIR}/firefox-${FIREFOX_VER:C/b.*//} 21WRKSRC= ${WRKDIR}/firefox-${FIREFOX_VER:C/b.*//}
22 22

cvs diff -r1.184 -r1.185 pkgsrc/www/firefox/mozilla-common.mk (expand / switch to unified diff)

--- pkgsrc/www/firefox/mozilla-common.mk 2020/11/11 15:30:46 1.184
+++ pkgsrc/www/firefox/mozilla-common.mk 2020/11/11 22:21:33 1.185
@@ -1,69 +1,42 @@ @@ -1,69 +1,42 @@
1# $NetBSD: mozilla-common.mk,v 1.184 2020/11/11 15:30:46 ryoon Exp $ 1# $NetBSD: mozilla-common.mk,v 1.185 2020/11/11 22:21:33 nia Exp $
2# 2#
3# common Makefile fragment for mozilla packages based on gecko 2.0. 3# common Makefile fragment for mozilla packages based on gecko 2.0.
4# 4#
5# used by www/firefox/Makefile 5# used by www/firefox/Makefile
6 6
7.include "../../mk/bsd.prefs.mk" 7.include "../../mk/bsd.prefs.mk"
8 8
9# Python 2.7 and Python 3.6 or later are required simultaneously. 9PYTHON_VERSIONS_INCOMPATIBLE= 27
10PYTHON_VERSIONS_ACCEPTED= 27 
11PYTHON_FOR_BUILD_ONLY= tool 10PYTHON_FOR_BUILD_ONLY= tool
12.if !empty(PYTHON_VERSION_DEFAULT:M3[6789]) 11ALL_ENV+= PYTHON3=${PYTHONBIN}
13TOOL_DEPENDS+= python${PYTHON_VERSION_DEFAULT}-[0-9]*:../../lang/python${PYTHON_VERSION_DEFAULT} 
14ALL_ENV+= PYTHON3=${PREFIX}/bin/python${PYTHON_VERSION_DEFAULT:S/3/3./} 
15.else 
16TOOL_DEPENDS+= python37-[0-9]*:../../lang/python37 
17ALL_ENV+= PYTHON3=${PREFIX}/bin/python3.7 
18.endif 
19 12
20HAS_CONFIGURE= yes 13HAS_CONFIGURE= yes
21CONFIGURE_ARGS+= --prefix=${PREFIX} 14CONFIGURE_ARGS+= --prefix=${PREFIX}
22USE_TOOLS+= pkg-config perl gmake autoconf213 gm4 unzip zip 15USE_TOOLS+= pkg-config perl gmake autoconf213 gm4 unzip zip
23UNLIMIT_RESOURCES+= datasize virtualsize 16UNLIMIT_RESOURCES+= datasize virtualsize
24 17
25.include "../../mk/compiler.mk" 18USE_LANGUAGES+= c c++
26 
27# firefox needs a compiler that supports gnu++14 and gnu++17. 
28# However, passing --std=gnu++17 (from wrappers, as a result of 
29# USE_LANGUAGES), results in problems for some Rust modules (as of 
30# 74.0). Therefore, do not declare the languages that are actually 
31# needed. 
32# \todo In pkgsrc infrastructure, separate the concept of needing a 
33# compiler that can implement a standard, and the concept of forcibly 
34# adding a --std flag. (The build system of a package should be 
35# setting the --std flag that is needed, rather than relying on the 
36# defaults of a particular compiler version.) 
37# NB: Even when building firefox with PKGSRC_COMPILER=gcc, the package 
38# will depend on and use clang, doing so outside the normal compiler 
39# selection framework. 
40USE_LANGUAGES+= c99 c++ 
41 19
42TOOL_DEPENDS+= cbindgen>=0.14.3:../../devel/cbindgen 20TOOL_DEPENDS+= cbindgen>=0.14.3:../../devel/cbindgen
43.if ${MACHINE_ARCH} == "sparc64" 21.if ${MACHINE_ARCH} == "sparc64"
44CONFIGURE_ARGS+= --disable-nodejs 22CONFIGURE_ARGS+= --disable-nodejs
45.else 23.else
46TOOL_DEPENDS+= nodejs-[0-9]*:../../lang/nodejs 24TOOL_DEPENDS+= nodejs-[0-9]*:../../lang/nodejs
47.endif 25.endif
48 26
49# Depend on Python3 sqlite3 module. 27TOOL_DEPENDS+= ${PYPKGPREFIX}-sqlite3-[0-9]*:../../databases/py-sqlite3
50.if !empty(PYTHON_VERSION_DEFAULT:M3[6789]) 28TOOL_DEPENDS+= ${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat
51BUILD_DEPENDS+= py${PYTHON_VERSION_DEFAULT}-sqlite3-[0-9]*:../../databases/py-sqlite3 29
52BUILD_DEPENDS+= py${PYTHON_VERSION_DEFAULT}-expat-[0-9]*:../../textproc/py-expat 
53.else 
54BUILD_DEPENDS+= py37-sqlite3-[0-9]*:../../databases/py-sqlite3 
55BUILD_DEPENDS+= py37-expat-[0-9]*:../../textproc/py-expat 
56.endif 
57.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" 30.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
58TOOL_DEPENDS+= nasm>=2.14:../../devel/nasm 31TOOL_DEPENDS+= nasm>=2.14:../../devel/nasm
59TOOL_DEPENDS+= yasm>=1.1:../../devel/yasm 32TOOL_DEPENDS+= yasm>=1.1:../../devel/yasm
60.endif 33.endif
61 34
62# For rustc/cargo detection 35# For rustc/cargo detection
63CONFIGURE_ARGS+= --target=${MACHINE_GNU_PLATFORM} 36CONFIGURE_ARGS+= --target=${MACHINE_GNU_PLATFORM}
64CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM} 37CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM}
65 38
66CONFIGURE_ENV+= BINDGEN_CFLAGS="-isystem${PREFIX}/include/nspr \ 39CONFIGURE_ENV+= BINDGEN_CFLAGS="-isystem${PREFIX}/include/nspr \
67 -isystem${X11BASE}/include/pixman-1" 40 -isystem${X11BASE}/include/pixman-1"
68 41
69test: 42test:
@@ -162,26 +135,38 @@ CONFIGURE_ARGS.Darwin+= --disable-sandbo @@ -162,26 +135,38 @@ CONFIGURE_ARGS.Darwin+= --disable-sandbo
162CONFIGURE_ARGS+= --enable-macos-target=10.4 135CONFIGURE_ARGS+= --enable-macos-target=10.4
163.elif !empty(MACHINE_PLATFORM:MDarwin-9.*-*) 136.elif !empty(MACHINE_PLATFORM:MDarwin-9.*-*)
164CONFIGURE_ARGS+= --enable-macos-target=10.5 137CONFIGURE_ARGS+= --enable-macos-target=10.5
165.endif 138.endif
166 139
167# Makefiles sometimes call "rm -f" without more arguments. Kludge around ... 140# Makefiles sometimes call "rm -f" without more arguments. Kludge around ...
168.PHONY: create-rm-wrapper 141.PHONY: create-rm-wrapper
169pre-configure: create-rm-wrapper 142pre-configure: create-rm-wrapper
170create-rm-wrapper: 143create-rm-wrapper:
171 printf '#!/bin/sh\n[ "$$*" = "-f" ] && exit 0\nexec /bin/rm $$@\n' > \ 144 printf '#!/bin/sh\n[ "$$*" = "-f" ] && exit 0\nexec /bin/rm $$@\n' > \
172 ${WRAPPER_DIR}/bin/rm 145 ${WRAPPER_DIR}/bin/rm
173 chmod +x ${WRAPPER_DIR}/bin/rm 146 chmod +x ${WRAPPER_DIR}/bin/rm
174 147
 148.PHONY: fix-clang-wrapper
 149pre-configure: fix-clang-wrapper
 150fix-clang-wrapper:
 151.if empty(PKGSRC_COMPILER:M*clang*)
 152# Firefox requires Clang during the build, even when building with GCC.
 153# XXX: When using GCC, pkgsrc provides 'clang' wrappers that are actually gcc.
 154# This breaks the build.
 155 ${LN} -sf ${PREFIX}/bin/clang ${WRKDIR}/.cwrapper/bin/clang
 156 ${LN} -sf ${PREFIX}/bin/clang++ ${WRKDIR}/.cwrapper/bin/clang++
 157 ${LN} -sf ${PREFIX}/bin/clang-cpp ${WRKDIR}/.cwrapper/bin/clang-cpp
 158.endif
 159
175# The configure test for __thread succeeds, but later we end up with: 160# The configure test for __thread succeeds, but later we end up with:
176# dist/bin/libxul.so: undefined reference to `__tls_get_addr' 161# dist/bin/libxul.so: undefined reference to `__tls_get_addr'
177CONFIGURE_ENV.NetBSD+= ac_cv_thread_keyword=no 162CONFIGURE_ENV.NetBSD+= ac_cv_thread_keyword=no
178# In unspecified case, clock_gettime(CLOCK_MONOTONIC, ...) fails. 163# In unspecified case, clock_gettime(CLOCK_MONOTONIC, ...) fails.
179CONFIGURE_ENV.NetBSD+= ac_cv_clock_monotonic= 164CONFIGURE_ENV.NetBSD+= ac_cv_clock_monotonic=
180 165
181.if ${OPSYS} == "OpenBSD" 166.if ${OPSYS} == "OpenBSD"
182PLIST_SUBST+= DLL_SUFFIX=".so.1.0" 167PLIST_SUBST+= DLL_SUFFIX=".so.1.0"
183.elif ${OPSYS} == "Darwin" 168.elif ${OPSYS} == "Darwin"
184PLIST_SUBST+= DLL_SUFFIX=".dylib" 169PLIST_SUBST+= DLL_SUFFIX=".dylib"
185.else 170.else
186PLIST_SUBST+= DLL_SUFFIX=".so" 171PLIST_SUBST+= DLL_SUFFIX=".so"
187.endif 172.endif
@@ -196,39 +181,26 @@ BUILDLINK_API_DEPENDS.libevent+= libeven @@ -196,39 +181,26 @@ BUILDLINK_API_DEPENDS.libevent+= libeven
196.include "../../devel/libffi/buildlink3.mk" 181.include "../../devel/libffi/buildlink3.mk"
197BUILDLINK_API_DEPENDS.nspr+= nspr>=4.26 182BUILDLINK_API_DEPENDS.nspr+= nspr>=4.26
198.include "../../devel/nspr/buildlink3.mk" 183.include "../../devel/nspr/buildlink3.mk"
199.include "../../textproc/icu/buildlink3.mk" 184.include "../../textproc/icu/buildlink3.mk"
200BUILDLINK_API_DEPENDS.nss+= nss>=3.56 185BUILDLINK_API_DEPENDS.nss+= nss>=3.56
201.include "../../devel/nss/buildlink3.mk" 186.include "../../devel/nss/buildlink3.mk"
202.include "../../devel/zlib/buildlink3.mk" 187.include "../../devel/zlib/buildlink3.mk"
203#.include "../../mk/jpeg.buildlink3.mk" 188#.include "../../mk/jpeg.buildlink3.mk"
204.include "../../graphics/MesaLib/buildlink3.mk" 189.include "../../graphics/MesaLib/buildlink3.mk"
205#BUILDLINK_API_DEPENDS.cairo+= cairo>=1.10.2nb4 190#BUILDLINK_API_DEPENDS.cairo+= cairo>=1.10.2nb4
206#.include "../../graphics/cairo/buildlink3.mk" 191#.include "../../graphics/cairo/buildlink3.mk"
207BUILDLINK_API_DEPENDS.libwebp+= libwebp>=1.0.2 192BUILDLINK_API_DEPENDS.libwebp+= libwebp>=1.0.2
208.include "../../graphics/libwebp/buildlink3.mk" 193.include "../../graphics/libwebp/buildlink3.mk"
209# Force the use of clang from pkgsrc, regardless of the setting of 
210# PKGSRC_COMPILER. 
211# When being compiled with GCC, Firefox will still need Clang for 
212# some purposes (why?) 
213# \todo pkgsrc cwrappers creates symlinks which make GCC pretend to be clang. 
214# this conflicts with Firefox's clang dependency, so currently GCC 
215# cannot be used to build Firefox. 
216# http://mail-index.netbsd.org/tech-pkg/2020/09/09/msg023783.html 
217# \todo This breaks the use of ccache, which should be fixed 
218PKG_CC= ${PREFIX}/bin/clang 
219PKG_CXX= ${PREFIX}/bin/clang++ 
220BUILDLINK_DEPMETHOD.clang= build 
221.include "../../lang/clang/buildlink3.mk" 
222.if !empty(MACHINE_PLATFORM:MNetBSD-8.*-*) 194.if !empty(MACHINE_PLATFORM:MNetBSD-8.*-*)
223BUILDLINK_DEPMETHOD.gcc8= full 195BUILDLINK_DEPMETHOD.gcc8= full
224.include "../../lang/gcc8/buildlink3.mk" 196.include "../../lang/gcc8/buildlink3.mk"
225CWRAPPERS_PREPEND.cxx+= \ 197CWRAPPERS_PREPEND.cxx+= \
226 -L${BUILDLINK_PREFIX.gcc8}/gcc8/lib \ 198 -L${BUILDLINK_PREFIX.gcc8}/gcc8/lib \
227 ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.gcc8}/gcc8/lib \ 199 ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.gcc8}/gcc8/lib \
228 -stdlib++-isystem \ 200 -stdlib++-isystem \
229 ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++ \ 201 ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++ \
230 -stdlib++-isystem \ 202 -stdlib++-isystem \
231 ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++/${MACHINE_GNU_PLATFORM} \ 203 ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++/${MACHINE_GNU_PLATFORM} \
232 -stdlib++-isystem \ 204 -stdlib++-isystem \
233 ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++/backward 205 ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++/backward
234.endif 206.endif