Bug 1656273 - Allow mac packaging to use a non-Firefox MOZ_APP_NAME r=mhentges,nalexander

This happened because the `browser/app/macbuild/Contents/MacOS-files.in` file had the string `firefox-bin` hardcoded, which introduces packaging failures down the line. The naive solution didn't work however because we don't preprocess this file. (This is apparently an error. We SHOULD have been doing this from day one, since this file contains preprocessor directives that are ignored by `rsync` since `#` is its "comment" character.) So preprocess the file and update the `Makefile` accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D86563
This commit is contained in:
Ricky Stewart 2020-08-10 20:29:22 +00:00
Родитель c3606a2ab2
Коммит 536be37164
5 изменённых файлов: 34 добавлений и 8 удалений

Просмотреть файл

@ -35,6 +35,7 @@ EXTRA_DEPS += $(srcdir)/firefox.exe.manifest
endif
PROGRAMS_DEST = $(DIST)/bin
objdir = $(topobjdir)/browser/app
include $(topsrcdir)/config/rules.mk
@ -81,16 +82,16 @@ clean clobber repackage::
MAC_BUNDLE_VERSION = $(shell $(PYTHON3) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/buildid.h)
.PHONY: repackage
tools repackage:: $(DIST)/bin/$(MOZ_APP_NAME)
tools repackage:: $(DIST)/bin/$(MOZ_APP_NAME) $(objdir)/macbuild/Contents/MacOS-files.txt
rm -rf $(dist_dest)
$(MKDIR) -p '$(dist_dest)/Contents/MacOS'
$(MKDIR) -p '$(dist_dest)/$(LPROJ)'
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents '$(dist_dest)' --exclude English.lproj
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ '$(dist_dest)/$(LPROJ)'
sed -e 's/%APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' -e 's/%MOZ_MACBUNDLE_ID%/$(MOZ_MACBUNDLE_ID)/' -e 's/%MAC_BUNDLE_VERSION%/$(MAC_BUNDLE_VERSION)/' -e 's|%MOZ_DEVELOPER_REPO_PATH%|$(topsrcdir)|' -e 's|%MOZ_DEVELOPER_OBJ_PATH%|$(topobjdir)|' $(srcdir)/macbuild/Contents/Info.plist.in > '$(dist_dest)/Contents/Info.plist'
sed -e 's/%APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MOZ_APP_NAME%/$(MOZ_APP_NAME)/' -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' -e 's/%MOZ_MACBUNDLE_ID%/$(MOZ_MACBUNDLE_ID)/' -e 's/%MAC_BUNDLE_VERSION%/$(MAC_BUNDLE_VERSION)/' -e 's|%MOZ_DEVELOPER_REPO_PATH%|$(topsrcdir)|' -e 's|%MOZ_DEVELOPER_OBJ_PATH%|$(topobjdir)|' $(srcdir)/macbuild/Contents/Info.plist.in > '$(dist_dest)/Contents/Info.plist'
sed -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > '$(dist_dest)/$(LPROJ)/InfoPlist.strings'
rsync -a --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ '$(dist_dest)/Contents/Resources'
rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
rsync -a --exclude-from='$(objdir)/macbuild/Contents/MacOS-files.txt' $(DIST)/bin/ '$(dist_dest)/Contents/Resources'
rsync -a --include-from='$(objdir)/macbuild/Contents/MacOS-files.txt' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
# MacOS-files-copy.in is a list of files that should be copies rather
# than symlinks and placed in .app/Contents/MacOS.
rsync -aL --include-from='$(srcdir)/macbuild/Contents/MacOS-files-copy.in' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'

Просмотреть файл

@ -163,7 +163,7 @@
</dict>
</array>
<key>CFBundleExecutable</key>
<string>firefox</string>
<string>%MOZ_APP_NAME%</string>
<key>CFBundleGetInfoString</key>
<string>%MAC_APP_NAME% %APP_VERSION%</string>
<key>CFBundleIconFile</key>

Просмотреть файл

@ -1,8 +1,11 @@
# Specifies files that should be copied (preserving symlinks) from dist/bin
# to the .app/Contents/MacOS directory.
#if 0
; Specifies files that should be copied (preserving symlinks) from dist/bin
; to the .app/Contents/MacOS directory.
#endif
#filter substitution
/*.app/***
/certutil
/firefox-bin
/@MOZ_APP_NAME@-bin
#if defined(MOZ_GECKODRIVER)
/geckodriver
#endif

Просмотреть файл

@ -0,0 +1,19 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
defs = []
for s in ('MOZ_GECKODRIVER', 'MOZ_ASAN', 'MOZ_TSAN', 'MOZ_CRASHREPORTER',
'MOZ_APP_NAME'):
if CONFIG[s]:
defs.append('-D%s=%s' % (s, '1' if CONFIG[s] is True else CONFIG[s]))
GeneratedFile(
'MacOS-files.txt',
script='/python/mozbuild/mozbuild/action/preprocessor.py',
entry_point='generate',
inputs=['MacOS-files.in'],
flags=defs)

Просмотреть файл

@ -29,6 +29,9 @@ with Files("profile/channel-prefs.js"):
with Files("profile/firefox.js"):
BUG_COMPONENT = ("Firefox", "General")
if CONFIG['MOZ_MACBUNDLE_NAME']:
DIRS += ['macbuild/Contents']
if CONFIG['MOZ_NO_PIE_COMPAT']:
GeckoProgram(CONFIG['MOZ_APP_NAME'] + '-bin')