Skip to content

Commit

Permalink
firefox: Enable build without nodejs dependency
Browse files Browse the repository at this point in the history
Patch is from martin@.
For the architecture that is not supported by nodejs, for example sparc64,
lang/nodejs should not be in www/firefox dependency.
  • Loading branch information
ryoon committed May 3, 2021
1 parent d211275 commit febaa03
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 6 deletions.
65 changes: 64 additions & 1 deletion www/firefox/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.476 2021/04/21 11:42:53 adam Exp $
# $NetBSD: Makefile,v 1.477 2021/05/03 16:31:37 ryoon Exp $

FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
MOZ_BRANCH= 88.0
Expand All @@ -11,11 +11,39 @@ CATEGORIES= www
MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
EXTRACT_SUFX= .tar.xz

DISTFILES= ${DEFAULT_DISTFILES} nodejs-output-88.0.tgz
SITES.nodejs-output-88.0.tgz= ${MASTER_SITE_LOCAL}

MAINTAINER= ryoon@NetBSD.org
HOMEPAGE= https://www.mozilla.org/en-US/firefox/
COMMENT= Web browser with support for extensions (version ${FIREFOX_VER:tu:C/\\.[[:digit:]\.]*//})
LICENSE= mpl-1.1

# -------- BEFORE UPDATING THIS PACKAGE PLEASE READ & UNDERSTAND: -------
#
# This package works around a (stupid) build time dependency on nodejs
# (which is not available for all architectures and unnecessary for the
# real build). To do this, it places some additional burden on the
# maintainer.
#
# While working on the package, please make sure you have
#
# FIREFOX_MAINTAINER=yes
#
# set in your build environment.
# When the package is ready for commit (but before commit), do:
#
# make maintainer-files
#
# This will do another round (depending on state of your work dir at this
# moment) of one or two builds and generate a cache of all output that
# nodejs generates during a build.
#
# When this is done, just commit the results (they will be in the files/
# directory).
#
# -----------------------------------------------------------------------

UNLIMIT_RESOURCES+= datasize virtualsize

WRKSRC= ${WRKDIR}/firefox-${FIREFOX_VER:C/b.*//}
Expand Down Expand Up @@ -106,6 +134,41 @@ pre-configure:
cd ${WRKSRC} && mkdir ${OBJDIR}
cd ${WRKSRC}/${OBJDIR} && touch old-configure.vars
# Do not fetch Rust Cargo file via network during build
.if !defined(FIREFOX_MAINTAINER)
mv ${WRKDIR}/dist ${WRKSRC}/${OBJDIR}
.endif

.if defined(FIREFOX_MAINTAINER)
# Create files needed only by the firefox maintainer when updating
# the package
# XXX - manually removing the .*_done files is wrong!
.PHONY: build-list
build-list:
cd ${WRKSRC}/${OBJDIR}/dist/bin/browser/chrome && \
find . -type f | sort > ${OUT:Q}

NODE_LIST="${WRKDIR}/node.list"
NO_NODE_LIST="${WRKDIR}/no-node.list"
NODE_FILES="${WRKDIR}/node.flist"

.PHONY: maintainer-files
maintainer-files:
rm -f ${FILESDIR}/node-wrapper.sh
V=$$( node -v ) && \
printf '#! /bin/sh\n\nVERS=%s\n\nif [ "$$1" = "-v" ] || [ "$$1" = "--version" ]; then\n\tprintf "$${VERS}\\n"\nfi\n\nexit 0\n' $$V \
> ${FILESDIR}/node-wrapper.sh && \
chmod 0755 ${FILESDIR}/node-wrapper.sh
rm -f ${WRKDIR}/.build_done ${WRKDIR}/.configure_done
$(MAKE) MAINTAINER_INTERNAL=yes build
$(MAKE) MAINTAINER_INTERNAL=yes OUT="${NO_NODE_LIST}" build-list
$(MAKE) OUT="${NODE_LIST}" build-list
${DIFF} -u "${NO_NODE_LIST}" "${NODE_LIST}" | \
${AWK} \
'/^\+\.\//{ printf("dist/bin/browser/chrome/%s\n", gensub(/^\+\.\//, "", "")) }' \
> "${NODE_FILES}"
cd ${WRKSRC}/${OBJDIR} && tar -c -T "${NODE_FILES}" -z \
-f ${FILESDIR}/nodejs-output-${PKGVERSION_NOREV}.tgz
.endif

post-build:
${SED} -e 's|@MOZILLA@|${MOZILLA}|g' \
Expand Down
6 changes: 5 additions & 1 deletion www/firefox/distinfo
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
$NetBSD: distinfo,v 1.433 2021/04/19 13:50:07 ryoon Exp $
$NetBSD: distinfo,v 1.434 2021/05/03 16:31:37 ryoon Exp $

SHA1 (firefox-88.0.source.tar.xz) = 7a40f520b5a91b9214debf4674acf553a852bd29
RMD160 (firefox-88.0.source.tar.xz) = 2e272a4497231a65c6a0fe9ee3550771d05d55fe
SHA512 (firefox-88.0.source.tar.xz) = f58f44f2f0d0f54eae5ab4fa439205feb8b9209b1bf2ea2ae0c9691e9e583bae2cbd4033edb5bdf4e37eda5b95fca688499bed000fe26ced8ff4bbc49347ce31
Size (firefox-88.0.source.tar.xz) = 373744508 bytes
SHA1 (nodejs-output-88.0.tgz) = e36945e45df7311113f4cd4c44dc76218444f7f8
RMD160 (nodejs-output-88.0.tgz) = ebde4f6b207b42d997d6791eaf17ab8f8d9310af
SHA512 (nodejs-output-88.0.tgz) = bdaad8a9ba4c3ad501018a4da0889194d47c0b9321fb265d4f14cee0588672e4ea113b3b3314b40ba0f54e09d8961e0d0732aede511830073180834ede82a1cf
Size (nodejs-output-88.0.tgz) = 200656 bytes
SHA1 (patch-aa) = 15b8567cee2af9853f6949c80345ffcb1fd3852a
SHA1 (patch-browser_app_profile_firefox.js) = 89cea0a66457c96ad0b94aaa524aa5942ad781d0
SHA1 (patch-build_moz.configure_rust.configure) = 25ddfacd29cebbc6db005dbe61a2a7446d480678
Expand Down
9 changes: 9 additions & 0 deletions www/firefox/files/node-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh

VERS=v14.16.1

if [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
printf "${VERS}\n"
fi

exit 0
13 changes: 9 additions & 4 deletions www/firefox/mozilla-common.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: mozilla-common.mk,v 1.201 2021/04/21 22:21:08 gutteridge Exp $
# $NetBSD: mozilla-common.mk,v 1.202 2021/05/03 16:31:37 ryoon Exp $
#
# common Makefile fragment for mozilla packages based on gecko 2.0.
#
Expand All @@ -21,10 +21,11 @@ USE_LANGUAGES+= c c++
GCC_REQD+= 7

TOOL_DEPENDS+= cbindgen>=0.16.0:../../devel/cbindgen
.if ${MACHINE_ARCH} == "sparc64"
CONFIGURE_ARGS+= --disable-nodejs
.else

.if defined(FIREFOX_MAINTAINER) && !defined(MAINTAINER_INTERNAL)
TOOL_DEPENDS+= nodejs-[0-9]*:../../lang/nodejs
.else
CONFIGURE_ENV+= NODEJS="${FILESDIR}/node-wrapper.sh"
.endif

TOOL_DEPENDS+= ${PYPKGPREFIX}-sqlite3-[0-9]*:../../databases/py-sqlite3
Expand Down Expand Up @@ -114,7 +115,11 @@ ALL_ENV+= SHELL=${CONFIG_SHELL:Q}

# Build outside ${WRKSRC}
# Try to avoid conflict with config/makefiles/xpidl/Makefile.in
.if ${MAINTAINER_INTERNAL:Uno} == "yes
OBJDIR= ../no-node-build
.else
OBJDIR= ../build
.endif
CONFIGURE_DIRS= ${OBJDIR}
CONFIGURE_SCRIPT= ${WRKSRC}/configure

Expand Down

0 comments on commit febaa03

Please sign in to comment.