mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 786520 - Install things to $(DIST)/branding from moz.build instead of manual rules in Makefile.ins. r=mshal
This commit is contained in:
parent
03cb210928
commit
5c00cfd457
@ -95,7 +95,7 @@ include backend.RecursiveMakeBackend.pp
|
||||
default:: backend.RecursiveMakeBackend
|
||||
|
||||
install_manifests := \
|
||||
$(addprefix dist/,bin idl include public private sdk xpi-stage) \
|
||||
$(addprefix dist/,bin branding idl include public private sdk xpi-stage) \
|
||||
_tests \
|
||||
$(NULL)
|
||||
install_manifest_depends = \
|
||||
|
@ -1,48 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
BRANDING_FILES := \
|
||||
firefox.ico \
|
||||
document.ico \
|
||||
branding.nsi \
|
||||
appname.bmp \
|
||||
bgintro.bmp \
|
||||
clock.bmp \
|
||||
particles.bmp \
|
||||
pencil.bmp \
|
||||
pencil-rtl.bmp \
|
||||
wizHeader.bmp \
|
||||
wizHeaderRTL.bmp \
|
||||
wizWatermark.bmp \
|
||||
newwindow.ico \
|
||||
newtab.ico \
|
||||
pbmode.ico \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
BRANDING_FILES := \
|
||||
background.png \
|
||||
firefox.icns \
|
||||
disk.icns \
|
||||
document.icns \
|
||||
dsstore \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_WIDGET_GTK
|
||||
BRANDING_FILES := \
|
||||
default16.png \
|
||||
default32.png \
|
||||
default48.png \
|
||||
mozicon128.png \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
BRANDING_DEST := $(DIST)/branding
|
||||
BRANDING_TARGET := export
|
||||
INSTALL_TARGETS += BRANDING
|
@ -9,7 +9,4 @@ DIRS += ['content', 'locales']
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
||||
JS_PREFERENCE_FILES += [
|
||||
'pref/firefox-branding.js',
|
||||
]
|
||||
|
||||
include('../branding-common.mozbuild')
|
||||
|
43
browser/branding/branding-common.mozbuild
Normal file
43
browser/branding/branding-common.mozbuild
Normal file
@ -0,0 +1,43 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; 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/.
|
||||
|
||||
JS_PREFERENCE_FILES += [
|
||||
'pref/firefox-branding.js',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
BRANDING_FILES += [
|
||||
'appname.bmp',
|
||||
'bgintro.bmp',
|
||||
'branding.nsi',
|
||||
'clock.bmp',
|
||||
'document.ico',
|
||||
'firefox.ico',
|
||||
'newtab.ico',
|
||||
'newwindow.ico',
|
||||
'particles.bmp',
|
||||
'pbmode.ico',
|
||||
'pencil-rtl.bmp',
|
||||
'pencil.bmp',
|
||||
'wizHeader.bmp',
|
||||
'wizHeaderRTL.bmp',
|
||||
'wizWatermark.bmp',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
BRANDING_FILES += [
|
||||
'background.png',
|
||||
'disk.icns',
|
||||
'document.icns',
|
||||
'dsstore',
|
||||
'firefox.icns',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_GTK']:
|
||||
BRANDING_FILES += [
|
||||
'default16.png',
|
||||
'default32.png',
|
||||
'default48.png',
|
||||
'mozicon128.png',
|
||||
]
|
@ -1,48 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
BRANDING_FILES := \
|
||||
firefox.ico \
|
||||
document.ico \
|
||||
branding.nsi \
|
||||
appname.bmp \
|
||||
bgintro.bmp \
|
||||
clock.bmp \
|
||||
particles.bmp \
|
||||
pencil.bmp \
|
||||
pencil-rtl.bmp \
|
||||
wizHeader.bmp \
|
||||
wizHeaderRTL.bmp \
|
||||
wizWatermark.bmp \
|
||||
newwindow.ico \
|
||||
newtab.ico \
|
||||
pbmode.ico \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
BRANDING_FILES := \
|
||||
background.png \
|
||||
firefox.icns \
|
||||
disk.icns \
|
||||
document.icns \
|
||||
dsstore \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_WIDGET_GTK
|
||||
BRANDING_FILES := \
|
||||
default16.png \
|
||||
default32.png \
|
||||
default48.png \
|
||||
mozicon128.png \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
BRANDING_DEST := $(DIST)/branding
|
||||
BRANDING_TARGET := export
|
||||
INSTALL_TARGETS += BRANDING
|
@ -9,7 +9,4 @@ DIRS += ['content', 'locales']
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
||||
JS_PREFERENCE_FILES += [
|
||||
'pref/firefox-branding.js',
|
||||
]
|
||||
|
||||
include('../branding-common.mozbuild')
|
||||
|
@ -1,48 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
BRANDING_FILES := \
|
||||
firefox.ico \
|
||||
document.ico \
|
||||
branding.nsi \
|
||||
appname.bmp \
|
||||
bgintro.bmp \
|
||||
clock.bmp \
|
||||
particles.bmp \
|
||||
pencil.bmp \
|
||||
pencil-rtl.bmp \
|
||||
wizHeader.bmp \
|
||||
wizHeaderRTL.bmp \
|
||||
wizWatermark.bmp \
|
||||
newwindow.ico \
|
||||
newtab.ico \
|
||||
pbmode.ico \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
BRANDING_FILES := \
|
||||
background.png \
|
||||
firefox.icns \
|
||||
disk.icns \
|
||||
document.icns \
|
||||
dsstore \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_WIDGET_GTK
|
||||
BRANDING_FILES := \
|
||||
default16.png \
|
||||
default32.png \
|
||||
default48.png \
|
||||
mozicon128.png \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
BRANDING_DEST := $(DIST)/branding
|
||||
BRANDING_TARGET := export
|
||||
INSTALL_TARGETS += BRANDING
|
@ -9,7 +9,4 @@ DIRS += ['content', 'locales']
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
||||
JS_PREFERENCE_FILES += [
|
||||
'pref/firefox-branding.js',
|
||||
]
|
||||
|
||||
include('../branding-common.mozbuild')
|
||||
|
@ -1,48 +0,0 @@
|
||||
# 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/.
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
BRANDING_FILES := \
|
||||
firefox.ico \
|
||||
document.ico \
|
||||
branding.nsi \
|
||||
appname.bmp \
|
||||
bgintro.bmp \
|
||||
clock.bmp \
|
||||
particles.bmp \
|
||||
pencil.bmp \
|
||||
pencil-rtl.bmp \
|
||||
wizHeader.bmp \
|
||||
wizHeaderRTL.bmp \
|
||||
wizWatermark.bmp \
|
||||
newwindow.ico \
|
||||
newtab.ico \
|
||||
pbmode.ico \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
BRANDING_FILES := \
|
||||
background.png \
|
||||
firefox.icns \
|
||||
disk.icns \
|
||||
document.icns \
|
||||
dsstore \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_WIDGET_GTK
|
||||
BRANDING_FILES := \
|
||||
default16.png \
|
||||
default32.png \
|
||||
default48.png \
|
||||
mozicon128.png \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
BRANDING_DEST := $(DIST)/branding
|
||||
BRANDING_TARGET := export
|
||||
INSTALL_TARGETS += BRANDING
|
@ -9,7 +9,4 @@ DIRS += ['content', 'locales']
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
||||
JS_PREFERENCE_FILES += [
|
||||
'pref/firefox-branding.js',
|
||||
]
|
||||
|
||||
include('../branding-common.mozbuild')
|
||||
|
@ -28,6 +28,7 @@ import mozpack.path as mozpath
|
||||
from .common import CommonBackend
|
||||
from ..frontend.data import (
|
||||
AndroidEclipseProjectData,
|
||||
BrandingFiles,
|
||||
ConfigFileSubstitution,
|
||||
ContextDerived,
|
||||
ContextWrapped,
|
||||
@ -377,6 +378,7 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
self._install_manifests = {
|
||||
k: InstallManifest() for k in [
|
||||
'dist_bin',
|
||||
'dist_branding',
|
||||
'dist_idl',
|
||||
'dist_include',
|
||||
'dist_public',
|
||||
@ -493,6 +495,9 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
elif isinstance(obj, Resources):
|
||||
self._process_resources(obj, obj.resources, backend_file)
|
||||
|
||||
elif isinstance(obj, BrandingFiles):
|
||||
self._process_branding_files(obj, obj.files, backend_file)
|
||||
|
||||
elif isinstance(obj, JsPreferenceFile):
|
||||
if obj.path.startswith('/'):
|
||||
backend_file.write('PREF_JS_EXPORTS += $(topsrcdir)%s\n' % obj.path)
|
||||
@ -940,6 +945,22 @@ INSTALL_TARGETS += %(prefix)s
|
||||
if not os.path.exists(source):
|
||||
raise Exception('File listed in RESOURCE_FILES does not exist: %s' % source)
|
||||
|
||||
def _process_branding_files(self, obj, files, backend_file):
|
||||
for source, dest, flags in self._walk_hierarchy(obj, files):
|
||||
if flags and flags.source:
|
||||
source = mozpath.normpath(mozpath.join(obj.srcdir, flags.source))
|
||||
if not os.path.exists(source):
|
||||
raise Exception('File listed in BRANDING_FILES does not exist: %s' % source)
|
||||
|
||||
self._install_manifests['dist_branding'].add_symlink(source, dest)
|
||||
|
||||
# Also emit the necessary rules to create $(DIST)/branding during partial
|
||||
# tree builds. The locale makefiles rely on this working.
|
||||
backend_file.write('NONRECURSIVE_TARGETS += export\n')
|
||||
backend_file.write('NONRECURSIVE_TARGETS_export += branding\n')
|
||||
backend_file.write('NONRECURSIVE_TARGETS_export_branding_DIRECTORY = $(DEPTH)\n')
|
||||
backend_file.write('NONRECURSIVE_TARGETS_export_branding_TARGETS += install-dist/branding\n')
|
||||
|
||||
def _process_installation_target(self, obj, backend_file):
|
||||
# A few makefiles need to be able to override the following rules via
|
||||
# make XPI_NAME=blah commands, so we default to the lazy evaluation as
|
||||
|
@ -953,6 +953,27 @@ VARIABLES = {
|
||||
This variable can only be used on Linux.
|
||||
""", None),
|
||||
|
||||
'BRANDING_FILES': (HierarchicalStringListWithFlagsFactory({'source': unicode}), list,
|
||||
"""List of files to be installed into the branding directory.
|
||||
|
||||
``BRANDING_FILES`` will copy (or symlink, if the platform supports it)
|
||||
the contents of its files to the ``dist/branding`` directory. Files that
|
||||
are destined for a subdirectory can be specified by accessing a field.
|
||||
For example, to export ``foo.png`` to the top-level directory and
|
||||
``bar.png`` to the directory ``images/subdir``, append to
|
||||
``BRANDING_FILES`` like so::
|
||||
|
||||
BRANDING_FILES += ['foo.png']
|
||||
BRANDING_FILES.images.subdir += ['bar.png']
|
||||
|
||||
If the source and destination have different file names, add the
|
||||
destination name to the list and set the ``source`` property on the
|
||||
entry, like so::
|
||||
|
||||
BRANDING_FILES.dir += ['baz.png']
|
||||
BRANDING_FILES.dir['baz.png'].source = 'quux.png'
|
||||
""", None),
|
||||
|
||||
'RESOURCE_FILES': (HierarchicalStringListWithFlagsFactory({'preprocess': bool}), list,
|
||||
"""List of resources to be exported, and in which subdirectories.
|
||||
|
||||
|
@ -248,6 +248,20 @@ class Resources(ContextDerived):
|
||||
defs.update(defines)
|
||||
self.defines = defs
|
||||
|
||||
class BrandingFiles(ContextDerived):
|
||||
"""Sandbox container object for BRANDING_FILES, which is a
|
||||
HierarchicalStringList.
|
||||
|
||||
We need an object derived from ContextDerived for use in the backend, so
|
||||
this object fills that role. It just has a reference to the underlying
|
||||
HierarchicalStringList, which is created when parsing BRANDING_FILES.
|
||||
"""
|
||||
__slots__ = ('files')
|
||||
|
||||
def __init__(self, sandbox, files):
|
||||
ContextDerived.__init__(self, sandbox)
|
||||
self.files = files
|
||||
|
||||
class JsPreferenceFile(ContextDerived):
|
||||
"""Context derived container object for a Javascript preference file.
|
||||
|
||||
|
@ -25,6 +25,7 @@ import reftest
|
||||
import mozinfo
|
||||
|
||||
from .data import (
|
||||
BrandingFiles,
|
||||
ConfigFileSubstitution,
|
||||
ContextWrapped,
|
||||
Defines,
|
||||
@ -664,6 +665,10 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
|
||||
yield DistFiles(context, dist_files, context['FINAL_TARGET'])
|
||||
|
||||
branding_files = context.get('BRANDING_FILES')
|
||||
if branding_files:
|
||||
yield BrandingFiles(context, branding_files)
|
||||
|
||||
self._handle_libraries(context)
|
||||
|
||||
for obj in self._process_test_manifests(context):
|
||||
|
@ -0,0 +1,14 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
BRANDING_FILES += [
|
||||
'app.ico',
|
||||
'bar.ico',
|
||||
'sub/quux.png',
|
||||
]
|
||||
BRANDING_FILES['app.ico'].source = 'bar.ico'
|
||||
|
||||
BRANDING_FILES.icons += [
|
||||
'foo.ico',
|
||||
]
|
||||
|
@ -405,6 +405,19 @@ class TestRecursiveMakeBackend(BackendTester):
|
||||
self.assertIn('res/tests/test.manifest', m)
|
||||
self.assertIn('res/tests/extra.manifest', m)
|
||||
|
||||
def test_branding_files(self):
|
||||
"""Ensure BRANDING_FILES is handled properly."""
|
||||
env = self._consume('branding-files', RecursiveMakeBackend)
|
||||
|
||||
#BRANDING_FILES should appear in the dist_branding install manifest.
|
||||
m = InstallManifest(path=os.path.join(env.topobjdir,
|
||||
'_build_manifests', 'install', 'dist_branding'))
|
||||
self.assertEqual(len(m), 4)
|
||||
self.assertIn('app.ico', m)
|
||||
self.assertIn('bar.ico', m)
|
||||
self.assertIn('quux.png', m)
|
||||
self.assertIn('icons/foo.ico', m)
|
||||
|
||||
def test_js_preference_files(self):
|
||||
"""Ensure PREF_JS_EXPORTS is written out correctly."""
|
||||
env = self._consume('js_preference_files', RecursiveMakeBackend)
|
||||
|
@ -0,0 +1,15 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
BRANDING_FILES += [
|
||||
'app.ico',
|
||||
'bar.ico',
|
||||
'baz.png',
|
||||
'foo.xpm',
|
||||
]
|
||||
BRANDING_FILES['app.ico'].source = 'test/bar.ico'
|
||||
|
||||
BRANDING_FILES.icons += [
|
||||
'quux.icns',
|
||||
]
|
||||
|
@ -10,6 +10,7 @@ import unittest
|
||||
from mozunit import main
|
||||
|
||||
from mozbuild.frontend.data import (
|
||||
BrandingFiles,
|
||||
ConfigFileSubstitution,
|
||||
Defines,
|
||||
DistFiles,
|
||||
@ -345,6 +346,23 @@ class TestEmitterBasic(unittest.TestCase):
|
||||
overwrite = resources._children['overwrite']
|
||||
self.assertEqual(overwrite._strings, ['new.res'])
|
||||
|
||||
def test_branding_files(self):
|
||||
reader = self.reader('branding-files')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
self.assertEqual(len(objs), 1)
|
||||
self.assertIsInstance(objs[0], BrandingFiles)
|
||||
|
||||
files = objs[0].files
|
||||
|
||||
self.assertEqual(files._strings, ['app.ico', 'bar.ico', 'baz.png', 'foo.xpm'])
|
||||
self.assertEqual(files['app.ico'].source, 'test/bar.ico')
|
||||
|
||||
self.assertIn('icons', files._children)
|
||||
icons = files._children['icons']
|
||||
|
||||
self.assertEqual(icons._strings, ['quux.icns'])
|
||||
|
||||
def test_preferences_js(self):
|
||||
reader = self.reader('js_preference_files')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
@ -38,19 +38,6 @@ endif
|
||||
#export:: brand.dtd.in
|
||||
# $(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $^ -o brand.dtd)
|
||||
|
||||
export::
|
||||
$(NSINSTALL) -D $(DIST)/branding
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
cp $(srcdir)/xulrunner.ico $(DIST)/branding/xulrunner.ico
|
||||
cp $(srcdir)/xulrunner.ico $(DIST)/branding/app.ico
|
||||
cp $(srcdir)/document.ico $(DIST)/branding/document.ico
|
||||
endif
|
||||
ifdef MOZ_WIDGET_GTK
|
||||
cp $(srcdir)/default16.png $(DIST)/branding/default16.png
|
||||
cp $(srcdir)/default32.png $(DIST)/branding/default32.png
|
||||
cp $(srcdir)/default48.png $(DIST)/branding/default48.png
|
||||
endif
|
||||
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
||||
FRAMEWORK_NAME = XUL
|
||||
|
@ -60,3 +60,17 @@ JS_PREFERENCE_FILES += [
|
||||
'xulrunner.js',
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
BRANDING_FILES += [
|
||||
'app.ico',
|
||||
'document.ico',
|
||||
'xulrunner.ico',
|
||||
]
|
||||
BRANDING_FILES['app.ico'].source = 'xulrunner.ico'
|
||||
|
||||
if CONFIG['MOZ_WIDGET_GTK']:
|
||||
BRANDING_FILES += [
|
||||
'default16.png',
|
||||
'default32.png',
|
||||
'default48.png',
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user