A rewrite in C++ and wxWidgets of a minimalistic pEp Linux Setup for Thuderbird.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

302 lines
9.8 KiB

null :=
space := ${null} ${null}
# You may override these variables in a CI or custom build:
#
ifeq ($(wildcard .git/refs/tags/*),)
VERSION := 2.2.0-RC.6
else
VERSION := $(shell git describe --tags | sed -e 's/^[^0-9][^_]*_//g')
endif
VERSION_XYZ := $(firstword $(subst -, ,$(VERSION)))
VERSION_XY := $(subst $(space),.,$(wordlist 1,2,$(subst ., ,$(VERSION_XYZ))))
#
BINARY_DL_VER := $(VERSION_XY).0
PEPMDA_VER := $(BINARY_DL_VER)
PLAT := x86_64
VARIANT := tb
#
json_mda_system :=
json_mda_user :=
engine_system_db :=
pEp4Tb_release :=
ifeq ($(MAKEDIR),)
MAKEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
export MAKEDIR
endif
# Either BSD or GNU shar is OK
ifeq ($(shar_cmd),)
shar_cmd := shar
endif
#
# json_mda_system := contrib/pEp/pEpJSONServerAdapter/server/pEp-mini-json-adapter
# json_mda_user := contrib/pEp/pEpJSONServerAdapter/server/pEp-mini-json-adapter
# engine_system_db := contrib/pEp/pEpEngine/src/system.db
# pEp4Tb_xpi := contrib/pEp/pEp_for_Thunderbird/dist/pEp4Tb@pEp.security.xpi
ifeq ($(OS),)
uname_s := $(shell uname -s)
ifeq ($(uname_s),Linux)
OS := lnx
else ifeq ($(uname_s),Darwin)
OS := darwin
endif
endif
BUNDLE_TAG := $(VARIANT)-$(OS)-$(PLAT)
BUNDLE_UTAG := $(VARIANT)_$(OS)_$(PLAT)
BUNDLE_VER_TAG := $(VARIANT)-$(OS)+$(VERSION)-$(PLAT)
BIN_PARTDIR := parts/$(VARIANT)-$(OS)-$(PLAT)
DISTDIR := dist/$(VARIANT)-$(OS)-$(PLAT)-$(VERSION)
SETUPDIR := $(DISTDIR)/pEp_Setup_Thunderbird/.Setup
PARTS_HOST := https://software.pep.foundation/tb/v$(BINARY_DL_VER)/
bundle_zip := dist/pEp_Setup_Thunderbird_$(BUNDLE_VER_TAG).zip
bundle_tgz := dist/pEp_Setup_Thunderbird_$(BUNDLE_VER_TAG).tgz
pEp_import_SRC = $(wildcard contrib/pEp/ImportFromEnigmail/*.py)
src_FILES = $(wildcard src/*.cc)
part_FILES = system.db \
pEp-mini-json-adapter.desktop \
pEp-mini-json-adapter.service \
pEp-mini-json-adapter.desktop.user \
pEp-mini-json-adapter.service.user
build_FILES = pEp4Tb@pEp.security.xpi
plat_FILES = pEp_install.sh \
pEp_import.sh \
pEp-mini-json-adapter \
pEp-mini-json-adapter.user \
pEp-mini-json-adapter-wrapper \
pEp-mini-json-adapter-cleanup \
tb_setup
po_LANG = en de
mo_FILES = $(patsubst %,locale/%/LC_MESSAGES/tb_setup.mo,$(po_LANG))
ifeq ($(OS),lnx)
Py_dist_FILES = $(wildcard plat/lnx/Python/lib/python2.7/*.py) \
$(wildcard plat/lnx/Python/lib/python2.7/encodings/*.py) \
$(wildcard plat/lnx/Python/lib/python2.7/json/*.py) \
$(wildcard plat/lnx/Python/lib/python2.7/xml/*.py) \
$(wildcard plat/lnx/Python/lib/python2.7/xml/*/*.py)
plat_FILES += Python/bin/python2.7s \
$(patsubst plat/lnx/%,%,$(Py_dist_FILES)) \
ImportLinux/mozprofile.py \
ImportLinux/pEp_import_better.py
endif
pEp_import_FILES = $(patsubst contrib/pEp/ImportFromEnigmail/%,Import/%,$(pEp_import_SRC))
Setup_FILES = $(part_FILES) \
$(plat_FILES) \
$(build_FILES) \
$(pEp_import_FILES)
Root_FILES = pEp_Thunderbird_Setup.desktop \
install.run
DISTFILES = $(bundle_zip)
all: $(bundle_zip)
src/tb_setup:
$(MAKE) $(MAKEOPTS) -C src tb_setup
bundle_DESTS = $(patsubst %,$(SETUPDIR)/%,$(BIN_PARTFILES)) \
$(patsubst %,$(SETUPDIR)/%,$(Setup_FILES)) \
$(patsubst %,$(SETUPDIR)/%,$(mo_FILES)) \
$(patsubst %,$(DISTDIR)/pEp_Setup_Thunderbird/%,$(Root_FILES))
print-version:
-@echo $(VERSION)
print-versions:
@echo Version: $(VERSION)
@echo Version X.Y: $(VERSION_XY)
@echo Version X.Y.Z: $(VERSION_XYZ)
@echo Binary ref: $(BINARY_DL_VER)
bundle_zip_layout:
mkdir -p $(SETUPDIR) $(SETUPDIR)/Import
$(SETUPDIR):
@mkdir -p $@
bundle_layout: $(SETUPDIR) $(bundle_zip_layout) $(bundle_DESTS)
sed -i.bak \
-e 's/^X-pEp-MDA-Version=.*$$/X-pEp-MDA-Version=$(VERSION)/' \
-e 's/^X-pEp-MDA-OS=.*$$/X-pEp-MDA-OS=$(OS)/' \
-e 's/^X-pEp-MDA-Variant=.*$$/X-pEp-MDA-Variant=$(VARIANT)/' \
-e 's/^X-pEp-MDA-Platform=.*$$/X-pEp-MDA-Platform=$(PLAT)/' \
$(DISTDIR)/pEp_Setup_Thunderbird/pEp_Thunderbird_Setup.desktop
@rm -f $(DISTDIR)/pEp_Setup_Thunderbird/pEp_Thunderbird_Setup.desktop.bak
zip: $(bundle_zip)
$(bundle_zip): bundle_layout
-@rm -f $@
cd $(DISTDIR) ; \
zip -yr $(MAKEDIR)/$@ pEp_Setup_Thunderbird
tgz: $(bundle_tgz)
$(bundle_tgz): bundle_layout
-@rm -f $@
cd $(DISTDIR) ; \
tar -czf $(MAKEDIR)/$@ pEp_Setup_Thunderbird
$(patsubst contrib/pEp/ImportFromEnigmail/%,$(SETUPDIR)/Import/%,$(pEp_import_SRC)):
@mkdir -p $(SETUPDIR)/Import
cp -f $(patsubst $(SETUPDIR)/Import/%,contrib/pEp/ImportFromEnigmail/%,$@) $@
$(patsubst %,$(SETUPDIR)/%,$(part_FILES)):
cp -f $(patsubst $(SETUPDIR)/%,parts/%,$@) $@
build/$(VARIANT)/xpi/build/pEp4Tb@pEp.security.xpi:
@rm -rf build/$(VARIANT)/xpi
@mkdir -p build/$(VARIANT)/xpi
cd contrib/pEp/pEpForThunderbird ; \
git status ; \
git tag ; \
git archive HEAD > $(MAKEDIR)/build/$(VARIANT)/xpi.tar
tar -C build/$(VARIANT)/xpi -xf build/$(VARIANT)/xpi.tar
cd build/$(VARIANT)/xpi ; $(MAKE) $(MAKEOPTS) all
.PHONY: build/$(VARIANT)/xpi/build/pEp4Tb@pEp.security.xpi
ifeq ($(pEp4Tb_release),)
$(SETUPDIR)/pEp4Tb@pEp.security.xpi: parts/pEp4Tb@pEp.security.xpi
else
$(SETUPDIR)/pEp4Tb@pEp.security.xpi: build/$(VARIANT)/xpi/build/pEp4Tb@pEp.security.xpi
endif
cp -vf $^ $@
ifneq ($(engine_system_db),)
$(SETUPDIR)/system.db: $(engine_system_db)
cp -f $^ $@
endif
$(patsubst %,$(SETUPDIR)/%,$(plat_FILES)):
@mkdir -p "$(shell dirname $@)"
@[ -e $(patsubst $(SETUPDIR)/%,plat/$(VARIANT)/$(OS)/%,$@) ] && \
cp -Hvf $(patsubst $(SETUPDIR)/%,plat/$(VARIANT)/$(OS)/%,$@) $@ || \
cp -Hvf $(patsubst $(SETUPDIR)/%,plat/$(OS)/%,$@) $@
ifneq ($(json_mda_system),)
$(SETUPDIR)/pEp-mini-json-adapter: $(json_mda_system)
cp -f $^ $@
endif
ifneq ($(json_mda_user),)
$(SETUPDIR)/pEp-mini-json-adapter.user: $(json_mda_user)
cp -f $^ $@
endif
$(patsubst %,$(DISTDIR)/pEp_Setup_Thunderbird/%,$(Root_FILES)):
[ -e $(patsubst $(DISTDIR)/pEp_Setup_Thunderbird/%,plat/$(VARIANT)/$(OS)/%,$@) ] && \
cp -Hf $(patsubst $(DISTDIR)/pEp_Setup_Thunderbird/%,plat/$(VARIANT)/$(OS)/%,$@) $@ || \
cp -Hf $(patsubst $(DISTDIR)/pEp_Setup_Thunderbird/%,plat/$(OS)/%,$@) $@
$(SETUPDIR)/locale/%/LC_MESSAGES/tb_setup.mo: locale/%/LC_MESSAGES/tb_setup.mo
echo $$(dirname "$@")
mkdir -p $$(dirname "$@")
cp -f $^ $@
$(SETUPDIR)/tb_setup: plat/$(OS)/tb_setup
plat/$(OS)/tb_setup: | src/tb_setup
@mkdir -p $(BIN_PARTDIR)
@echo "TODO: Must install manually:"
@echo " cp -f $< $@" && false
plat/$(OS)/install.run: | src/launcher/install.run
@mkdir -p $(BIN_PARTDIR)
@echo "TODO: Must install manually:"
@echo " cp -f $< $@" && false
plat/$(OS)/ImportLinux/mozprofile.py: src/ImportLinux/mozprofile.py
@mkdir -p plat/$(OS)/ImportLinux
cp -f $^ $@
plat/$(OS)/ImportLinux/pEp_import_better.py: src/ImportLinux/pEp_import_better.py
@mkdir -p plat/$(OS)/ImportLinux
cp -f $^ $@
webinstall_NAME = pEp_Thunderbird_$(BUNDLE_VER_TAG)_webinstall.sh
webinstall: $(DISTDIR)/$(webinstall_NAME)
$(DISTDIR)/$(webinstall_NAME): $(bundle_tgz)
cd $(DISTDIR) ; \
cat "$(MAKEDIR)"/webstart/preamble.sh > $(webinstall_NAME)
base64 $(bundle_tgz) > $(DISTDIR)/tb_setup.tgz.b64
cd $(DISTDIR) ; \
$(shar_cmd) tb_setup.tgz.b64 >> $(webinstall_NAME)
-@rm -f $(DISTDIR)/tb_setup.tgz.b64
webstart:
PEP_ADAPTER_BUNDLE_VER=$(VERSION) webstart/install_web.sh
.PHONY: webstart
download-parts:
ls -l /install/* || true
#curl -L $(PARTS_HOST)/parts/pepmda-tb-linux+$(PEPMDA_VER)-x86_64.zip > contrib/pepmda.zip
#mkdir -p build/pepmda
#unzip -d build/pepmda contrib/pepmda.zip
#cp -fH build/pepmda/share/pEp/system.db parts/system.db
#if [ ! -e plat/lnx/pEp-mini-json-adapter ] ; then \
# cp -fH build/pepmda/bin/pEp-mini-json-adapter plat/lnx/pEp-mini-json-adapter && \
# cp -fH build/pepmda/bin/pEp-mini-json-adapter.user plat/lnx/pEp-mini-json-adapter.user ; \
#fi
curl -L $(PARTS_HOST)/parts/Python27-static.tgz > contrib/Python27-static.tgz
tar -C plat/lnx/ -xf contrib/Python27-static.tgz
# curl -L $(PARTS_HOST)/parts/pEp4Tb@pEp.security.xpi > plat/lnx/pEp4Tb@pEp.security.xpi
# curl -L $(PARTS_HOST)/parts/pEp-mini-json-adapter.user > plat/lnx/pEp-mini-json-adapter.user
# curl -L $(PARTS_HOST)/parts/tb_setup > plat/lnx/tb_setup
# chmod 755 plat/lnx/tb_setup
update-pot: locale/tb_setup.pot
locale/tb_setup.pot: $(src_FILES) ./plat/lnx/pEp_install.sh ./plat/lnx/pEp_import.sh
xgettext -d tb_setup -s --keyword=_ -p ./locale -o tb_setup.pot --from-code=utf-8 $(src_FILES)
xgettext -d tb_setup -s -L Shell --keyword --keyword=tr -p ./locale -o tb_setup.pot --from-code=utf-8 -j \
./plat/lnx/pEp_install.sh \
./plat/lnx/pEp_import.sh
sed -i.bak 's/charset=CHARSET/charset=UTF-8/g' ./locale/tb_setup.pot
-@rm -f ./locale/tb_setup.pot.bak
update-po: $(patsubst %,locale/%/LC_MESSAGES/tb_setup.po,$(po_LANG))
$(patsubst %,locale/%/LC_MESSAGES/tb_setup.po,$(po_LANG)): locale/tb_setup.pot
if [ ! -e $@ ] ; then cp -f $^ $@ ; fi
if grep -q charset=CHARSET $@ ; then sed -i.bak 's/charset=CHARSET/charset=UTF-8/g' $@ ; fi
-@rm -f $@.bak
msgmerge -U $@ $^
merge-translations:
set -e ; TD=$$(mktemp -d) ; \
git --git-dir="$$MAKEDIR/.git" --work-tree "$$TD" checkout translations -- locale/ ; \
for PO in $$(git --git-dir="$$MAKEDIR/.git" ls-files \*.po) ; do \
msgmerge -U "$$TD/$$PO" "$$MAKEDIR/$$PO" && \
msgmerge -U "$$MAKEDIR/$$PO" "$$TD/$$PO" ; \
done ; \
rm -rf "$$TD"
update-mo: $(patsubst %,locale/%/LC_MESSAGES/tb_setup.mo,$(po_LANG))
locale/%/LC_MESSAGES/tb_setup.mo: locale/%/LC_MESSAGES/tb_setup.po
msgfmt -o $@ $^
-include GNUmakefile.local