2021-04-27 15:08:58 +02:00
|
|
|
#
|
|
|
|
# Front-end based on GNU make, intended for a more friendly
|
|
|
|
# integration of the build system with Linux/UNIX distributions,
|
|
|
|
# as well as for those who still allergy using mach command.
|
|
|
|
#
|
|
|
|
# Place it as `mozilla/GNUmakefile' (instead of the existing stub),
|
|
|
|
# and work under `mozilla/' dir.
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# For build, just use
|
|
|
|
#
|
|
|
|
# make
|
|
|
|
#
|
|
|
|
# (If you want to separate config stage, use "make configure" and then "make",
|
|
|
|
# but normally it is done automatically).
|
|
|
|
#
|
|
|
|
# For install, use
|
|
|
|
#
|
|
|
|
# make install DESTDIR=where_you_want_to_install
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Additionally, before install you can use:
|
|
|
|
#
|
|
|
|
# make locales
|
|
|
|
#
|
|
|
|
# to provide all the shipped locales (will appear in a form of langpack extensions).
|
2021-05-18 15:16:24 +02:00
|
|
|
# If irc and/or calendar are built, their data will be included too.
|
2021-04-27 15:08:58 +02:00
|
|
|
# (See below for more details about locales target).
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# For clarity, some comparison with the other build methods
|
|
|
|
# (assume `-jN' is the option for parallel builds, ie. `-j4' for 4-cpu system):
|
|
|
|
#
|
|
|
|
# Build stage:
|
|
|
|
#
|
|
|
|
# client.mk: make -f client.mk build MOZ_MAKE_FLAGS=-jN
|
|
|
|
# mach: ./mach build -jN
|
|
|
|
# THIS: make -jN
|
|
|
|
#
|
|
|
|
# Install stage:
|
|
|
|
#
|
|
|
|
# client.mk: DESTDIR=where... make -f client.mk install
|
|
|
|
# mach: DESTDIR=where... make -C $OBJDIR... install
|
|
|
|
# THIS: make install DESTDIR=where...
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
ifeq (,$(wildcard .mozconfig))
|
|
|
|
$(error Cannot find .mozconfig file in the current directory)
|
|
|
|
endif
|
|
|
|
|
|
|
|
MACH_CMD = ./mach --log-no-times
|
|
|
|
|
|
|
|
OBJDIR := $(shell $(MACH_CMD) environment --format=json | sed -e 's/.*"topobjdir": "//' -e 's/".*//')
|
|
|
|
|
|
|
|
OBJDIR_TARGETS = install distribution source-package package clobber
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: all configure build clean distclean $(OBJDIR_TARGETS)
|
|
|
|
|
|
|
|
|
|
|
|
all: build
|
|
|
|
|
|
|
|
|
|
|
|
configure: $(OBJDIR)/Makefile
|
|
|
|
|
|
|
|
|
|
|
|
$(OBJDIR)/Makefile: .mozconfig
|
|
|
|
$(MACH_CMD) configure
|
|
|
|
|
|
|
|
|
|
|
|
build: $(OBJDIR)/Makefile
|
|
|
|
$(MAKE) -C $(OBJDIR)
|
|
|
|
|
|
|
|
|
|
|
|
$(OBJDIR_TARGETS):
|
|
|
|
$(MAKE) -C $(OBJDIR) $@
|
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(MACH_CMD) clobber
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -f configure js/src/configure
|
|
|
|
rm -rf $(OBJDIR)
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# LOCALES
|
|
|
|
#
|
|
|
|
#
|
2021-05-18 15:16:24 +02:00
|
|
|
# The target `locales' creates all the needed langpacks.
|
|
|
|
#
|
2021-04-27 15:08:58 +02:00
|
|
|
# By default, all available locales will be used. You can change it
|
|
|
|
# by overriding SHIPPED_LOCALES variable on the command line.
|
|
|
|
#
|
2021-05-18 15:16:24 +02:00
|
|
|
# Additionally, you can use `make locale-LANG' to create one (or several)
|
|
|
|
# langpack separately.
|
2021-04-27 15:08:58 +02:00
|
|
|
#
|
2021-05-18 15:16:24 +02:00
|
|
|
# For example, to build `fr' and 'it' only, use:
|
2021-04-27 15:08:58 +02:00
|
|
|
#
|
|
|
|
# make locales SHIPPED_LOCALES="fr it"
|
|
|
|
#
|
|
|
|
# to create just `ru' langpack:
|
|
|
|
#
|
|
|
|
# make locale-ru
|
|
|
|
#
|
2021-05-18 15:16:24 +02:00
|
|
|
# Use `clear-locales' for clearing.
|
2021-04-27 15:08:58 +02:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# NOTE! NOTE! NOTE!
|
|
|
|
#
|
|
|
|
# Do NOT use parallel builds (-jN) for locale targets!
|
|
|
|
#
|
|
|
|
# It is better to use `-j1' explicitly (`make -j1 locales') to avoid issues.
|
|
|
|
#
|
|
|
|
|
2021-05-18 15:16:24 +02:00
|
|
|
.PHONY: locales clear-locales dictionaries clear-dictionaries
|
2021-04-27 15:08:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
drop_extra := $(if $(or $(filter Windows_NT,$(OS)),$(filter-out Darwin,$(shell uname))),ja-JP-mac,ja)
|
|
|
|
|
|
|
|
SHIPPED_LOCALES := $(shell while read loc rest; do echo $$loc; done <comm/suite/locales/shipped-locales)
|
|
|
|
SHIPPED_LOCALES := $(filter-out en-US $(drop_extra),$(sort $(SHIPPED_LOCALES)))
|
|
|
|
|
2021-05-18 15:16:24 +02:00
|
|
|
locales: $(SHIPPED_LOCALES:%=locale-%)
|
2021-04-27 15:08:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
PACKAGE_MANIFEST = $(OBJDIR)/comm/suite/installer/package-manifest
|
|
|
|
|
|
|
|
$(PACKAGE_MANIFEST):
|
|
|
|
cp comm/suite/installer/package-manifest.in $@
|
|
|
|
sed -i '/MOZ_PKG_MANIFEST =/ s,.*,MOZ_PKG_MANIFEST = $$(topobjdir)/comm/suite/installer/package-manifest,' \
|
|
|
|
$(OBJDIR)/comm/suite/installer/Makefile
|
|
|
|
|
|
|
|
|
|
|
|
stage := $(OBJDIR)/dist/xpi-stage/locale
|
|
|
|
|
|
|
|
.PRECIOUS: $(stage)-%
|
|
|
|
|
|
|
|
$(stage)-%:
|
|
|
|
$(MAKE) -C $(OBJDIR)/comm/suite/locales langpack-$*
|
|
|
|
|
2021-05-18 15:16:24 +02:00
|
|
|
# Combine extensions data with the main localization stuff and leave only one manifest file
|
2023-01-20 12:08:15 +01:00
|
|
|
for manifest in `find $@/extensions -name "*.manifest" -print` ; \
|
2021-05-18 15:16:24 +02:00
|
|
|
do \
|
|
|
|
while read keyword name lang path rest ; \
|
|
|
|
do \
|
|
|
|
[ "$$keyword" = locale ] || continue ; \
|
|
|
|
[ "$$lang" = "$*" ] || continue ; \
|
|
|
|
[ "$${path%/*/}/$$name/" = "$$path" ] || continue ; \
|
|
|
|
tar -C $${manifest%/*}/$${path%/*/} -chf - $$name | tar -C $@/chrome/$*/locale/$* -xf - ; \
|
|
|
|
echo "locale $$name $* $*/locale/$*/$$name/$${rest:+ $$rest}" >> $@/chrome/$*.manifest ; \
|
|
|
|
done < $$manifest ; \
|
|
|
|
done
|
|
|
|
|
|
|
|
sed 's,$*/locale/$*,chrome/&,' $@/chrome/$*.manifest | sort > $@/chrome.manifest
|
|
|
|
rm -f $@/chrome/$*.manifest
|
2021-04-27 15:08:58 +02:00
|
|
|
|
|
|
|
# Spanish locales other than es-ES are from Latam, where the es-AR langpack is most preferred
|
2023-01-20 12:08:15 +01:00
|
|
|
[ $* = es-AR ] && sed -i '/^locale/ s/ es-AR / es /' $@/chrome.manifest || :
|
2021-04-27 15:08:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
locale-%: REL_NAME = extensions/langpack-$*@seamonkey.mozilla.org.xpi
|
|
|
|
locale-%: DEST_NAME = $(OBJDIR)/dist/bin/$(REL_NAME)
|
|
|
|
locale-%: manifest_entry = @RESPATH@/$(REL_NAME)
|
|
|
|
|
|
|
|
# To avoid performance issues in multi-locale installs, put the manifest files
|
|
|
|
# into the beginning of the archive, and do not compress them.
|
|
|
|
|
|
|
|
locale-%: $(stage)-% $(PACKAGE_MANIFEST)
|
|
|
|
rm -f $(DEST_NAME)
|
2021-05-18 15:16:24 +02:00
|
|
|
cd $<; zip -0 -D -X $(DEST_NAME) chrome.manifest install.rdf
|
2021-04-27 15:08:58 +02:00
|
|
|
cd $<; zip -g -r -9 -D -X $(DEST_NAME) chrome/$*
|
|
|
|
fgrep $(manifest_entry) $(PACKAGE_MANIFEST) || echo $(manifest_entry) >>$(PACKAGE_MANIFEST)
|
|
|
|
|
|
|
|
|
|
|
|
clear-locales:
|
|
|
|
sed -i '/langpack-.*@seamonkey.mozilla.org.xpi/ d' $(PACKAGE_MANIFEST)
|
|
|
|
rm -f $(OBJDIR)/dist/bin/extensions/langpack-*@seamonkey.mozilla.org.xpi
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Dictionaries
|
|
|
|
#
|
|
|
|
# It is better to use system dictionaries, specifying directory path for them
|
2021-05-18 15:16:24 +02:00
|
|
|
# by "spellchecker.dictionary_path" preference (or even use symlink when possible).
|
2021-04-27 15:08:58 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
DICT_DEST := $(OBJDIR)/dist/bin/dictionaries
|
|
|
|
|
|
|
|
dictionaries: $(SHIPPED_LOCALES:%=$(stage)-%)
|
|
|
|
cp -f -d $(wildcard $(foreach loc,$(SHIPPED_LOCALES),$(stage)-$(loc)/dictionaries/$(loc).aff $(stage)-$(loc)/dictionaries/$(loc).dic)) $(DICT_DEST)
|
|
|
|
|
|
|
|
clear-dictionaries:
|
|
|
|
rm -f $(filter-out $(DICT_DEST)/en-US.%,$(wildcard $(DICT_DEST)/*.aff $(DICT_DEST)/*.dic))
|
|
|
|
|