This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
forked from mdlavin/firefox-gnome-keyring
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
84 lines (66 loc) · 2.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
PACKAGE ?= firefox-gnome-keyring
VERSION ?= $(shell git describe --tags 2>/dev/null || date +dev-%s)
# max/min compatibility versions to set, only if "xulrunner" tool is not available
XUL_VER_MIN ?= 6.0.1
XUL_VER_MAX ?= 6.*
# package distribution variables
FULLNAME ?= $(PACKAGE)-$(VERSION)
ARCHIVENAME ?= $(FULLNAME)
# xulrunner tools. use = not ?= so we don't execute on every invocation
XUL_PKG_NAME = $(shell (pkg-config --atleast-version=2 libxul && echo libxul) || (pkg-config libxul2 && echo libxul2))
XULRUNNER = $(shell find -L $$(dirname $$(pkg-config --libs-only-L $(XUL_PKG_NAME) | tail -c+3)) -name xulrunner)
# compilation flags
XUL_CFLAGS := `pkg-config --cflags $(XUL_PKG_NAME) gnome-keyring-1` -DMOZ_NO_MOZALLOC
XUL_LDFLAGS := `pkg-config --libs $(XUL_PKG_NAME) | sed 's/xpcomglue_s/xpcomglue_s_nomozalloc/' | sed 's/-lmozalloc//'`
GNOME_LDFLAGS := `pkg-config --libs gnome-keyring-1`
CPPFLAGS += -fno-rtti -fno-exceptions -shared -fPIC -g -std=gnu++0x
# construct Mozilla architectures string
ARCH := $(shell uname -m)
ARCH := $(shell echo ${ARCH} | sed 's/i686/x86/')
PLATFORM := $(shell uname)_$(ARCH)-gcc3
TARGET := libgnomekeyring.so
XPI_TARGET := gnome-keyring_password_integration-$(VERSION).xpi
BUILD_FILES := \
xpi/platform/$(PLATFORM)/components/$(TARGET) \
xpi/install.rdf \
xpi/chrome.manifest
.PHONY: all build build-xpi tarball
all: build
build: build-xpi
build-xpi: $(XPI_TARGET)
$(XPI_TARGET): $(BUILD_FILES)
cd xpi && zip -rq ../$@ *
xpi/platform/$(PLATFORM)/components/$(TARGET): $(TARGET)
mkdir -p xpi/platform/$(PLATFORM)/components
cp -a $< $@
xpi/install.rdf: install.rdf Makefile
mkdir -p xpi
XUL_VER_MIN=`$(XULRUNNER) --gre-version`; \
XUL_VER_MAX=`$(XULRUNNER) --gre-version | sed -rn -e 's/([^.]+).*/\1.*/gp'`; \
sed -e 's/$${PLATFORM}/'$(PLATFORM)'/g' \
-e 's/$${VERSION}/'$(VERSION)'/g' \
-e 's/$${XUL_VER_MIN}/'"$${XUL_VER_MIN:-$(XUL_VER_MIN)}"'/g' \
-e 's/$${XUL_VER_MAX}/'"$${XUL_VER_MAX:-$(XUL_VER_MAX)}"'/g' \
$< > $@
xpi/chrome.manifest: chrome.manifest Makefile
mkdir -p xpi
sed -e 's/$${PLATFORM}/'$(PLATFORM)'/g' \
$< > $@
$(TARGET): GnomeKeyring.cpp GnomeKeyring.h Makefile
test -n "$(XUL_PKG_NAME)" || { echo "libxul missing" && false; }
$(CXX) $< -g -Wall -o $@ \
$(XUL_CFLAGS) $(XUL_LDFLAGS) $(GNOME_LDFLAGS) $(CPPFLAGS) \
$(CXXFLAGS) $(GECKO_DEFINES)
chmod +x $@
tarball:
git archive --format=tar \
--prefix=$(FULLNAME)/ HEAD \
| gzip - > $(ARCHIVENAME).tar.gz
.PHONY: clean-all clean
clean:
rm -f $(TARGET)
rm -f $(XPI_TARGET)
rm -f -r xpi
clean-all: clean
rm -f *.xpi
rm -f *.tar.gz