projects/package-update-indicator

view Makefile @ 6:2477a6151087

Make PackagKit use the user's network proxies

Pick up network proxies from the user's environment and make PackagKit use
them. Setting network proxies is a privileged operation, so it is only
attempted if the user is allowed to use the polkit action
org.freedesktop.packagekit.system-network-proxy-configure without
authentication.
author Guido Berhoerster <guido+pui@berhoerster.name>
date Tue Jun 19 15:44:36 2018 +0200 (2018-06-19)
parents a4020e99e550
children adba37525ee5
line source
1 #
2 # Copyright (C) 2018 Guido Berhoerster <guido+pui@berhoerster.name>
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining
5 # a copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish,
8 # distribute, sublicense, and/or sell copies of the Software, and to
9 # permit persons to whom the Software is furnished to do so, subject to
10 # the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 #
24 PACKAGE = package-update-indicator
25 APPLICATION_ID = org.guido-berhoerster.code.package-update-indicator
26 PREFS_APPLICATION_ID = org.guido-berhoerster.code.package-update-indicator.preferences
27 VERSION = 1
28 DISTNAME = $(PACKAGE)-$(VERSION)
29 AUTHOR = Guido Berhoerster
30 BUG_ADDRESS = guido+pui@berhoerster.name
32 # gcc, clang, icc, Sun/Solaris Studio
33 CC := $(CC) -std=c99
34 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c
35 # gcc, clang, icc
36 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
37 # Sun/Solaris Studio
38 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
39 # X makedepend
40 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) --
41 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
42 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
43 CP := cp
44 INSTALL := install
45 INSTALL.exec := $(INSTALL) -D -m 0755
46 INSTALL.data := $(INSTALL) -D -m 0644
47 INSTALL.link := $(CP) -f -P
48 PAX := pax
49 GZIP := gzip
50 SED := sed
51 GLIB_COMPILE_SCHEMAS := $(shell pkg-config --variable=glib_compile_schemas gio-2.0)
52 GLIB_COMPILE_RESOURCES := $(shell pkg-config --variable=glib_compile_resources gio-2.0)
53 XSLTPROC := xsltproc
54 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
55 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
56 --stringparam man.copyright.section.enabled 0
57 MSGFMT = msgfmt
58 MSGMERGE = msgmerge
59 XGETTEXT = xgettext
60 XGETTEXT_OPTIONS = --copyright-holder "$(AUTHOR)" \
61 --package-name '$(PACKAGE)' \
62 --package-version '$(VERSION)' \
63 --msgid-bugs-address '$(BUG_ADDRESS)' \
64 --default-domain '$(PACKAGE)' \
65 --from-code UTF-8 \
66 --keyword=_ \
67 --keyword=N_ \
68 --keyword=C_:1c,2 \
69 --keyword=NC_:1c,2 \
70 --keyword=g_dngettext:2,3 \
71 --add-comments
73 define generate-manpage-rule =
74 %.$1: %.$(addsuffix .xml,$1) docbook-update-source-data.xsl
75 $$(XSLTPROC) \
76 --xinclude \
77 --stringparam package $$(PACKAGE) \
78 --stringparam version $$(VERSION) \
79 docbook-update-source-data.xsl $$< | \
80 $$(XSLTPROC) \
81 --xinclude \
82 --output $$@ \
83 $$(DOCBOOK5_MANPAGES_FLAGS) \
84 $$(DOCBOOK5_MANPAGES_STYLESHEET) \
85 -
86 endef
88 DESTDIR ?=
89 prefix ?= /usr/local
90 bindir ?= $(prefix)/bin
91 datadir ?= $(prefix)/share
92 mandir ?= $(datadir)/man
93 localedir ?= $(datadir)/locale
94 sysconfdir ?= /etc
95 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
96 xdgapplicationsdir ?= $(datadir)/applications
98 OS_NAME := $(shell uname -s)
99 OS_RELEASE := $(shell uname -r)
101 $(PACKAGE)_OBJS = package-update-indicator.o \
102 pui-application.o \
103 pui-backend.o \
104 pui-get-updates.o \
105 pui-settings.o \
106 pui-types.o \
107 pui-resources.o
109 $(PACKAGE)-prefs_OBJS = package-update-indicator-prefs.o \
110 pui-prefs-application.o \
111 pui-settings.o \
112 pui-prefs-resources.o
114 OBJS = $($(PACKAGE)_OBJS) $($(PACKAGE)-prefs_OBJS)
116 GSETTINGS_SCHEMAS = $(APPLICATION_ID).gschema.xml
118 GRESOURCE_FILES = pui-prefs.gresource.xml
120 AUTOSTART_FILE = $(APPLICATION_ID).desktop
122 DESKTOP_FILES = $(PREFS_APPLICATION_ID).desktop
124 LINGUAS := $(shell sed 's/\#.*//' po/LINGUAS)
125 MOFILES := $(patsubst %,po/%.mo,$(LINGUAS))
126 POTFILES_IN := $(shell sed 's/\#.*//' po/POTFILES.in)
127 POTFILE = po/$(PACKAGE).pot
129 MANPAGES = $(PACKAGE).1 $(PACKAGE)-prefs.1
131 .DEFAULT_TARGET = all
133 .PHONY: all pot update-po clean clobber dist install
135 all: $(PACKAGE) $(PACKAGE)-prefs $(AUTOSTART_FILE) $(DESKTOP_FILES) $(MOFILES) $(MANPAGES)
137 $(PACKAGE): XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
138 -DAPPLICATION_ID=\"$(APPLICATION_ID)\" \
139 -DVERSION=\"$(VERSION)\" \
140 -DG_LOG_DOMAIN=\"$(PACKAGE)\" \
141 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
142 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
143 -DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\" \
144 -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
145 $(PACKAGE): XCFLAGS = $(shell pkg-config --cflags gtk+-3.0 \
146 appindicator3-0.1 packagekit-glib2 \
147 polkit-gobject-1 upower-glib)
148 $(PACKAGE): LDLIBS = $(shell pkg-config --libs gtk+-3.0 \
149 appindicator3-0.1 packagekit-glib2 \
150 polkit-gobject-1 upower-glib)
152 $(PACKAGE)-prefs: XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
153 -DAPPLICATION_ID=\"$(PREFS_APPLICATION_ID)\" \
154 -DVERSION=\"$(VERSION)\" \
155 -DG_LOG_DOMAIN=\"$(PACKAGE)\" \
156 -DPACKAGE_LOCALE_DIR="\"$(localedir)\"" \
157 -DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
158 -DSETTINGS_SCHEMA_ID=\"$(APPLICATION_ID)\"
159 $(PACKAGE)-prefs: XCFLAGS = $(shell pkg-config --cflags gtk+-3.0)
160 $(PACKAGE)-prefs: LDLIBS = $(shell pkg-config --libs gtk+-3.0)
162 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),)
163 $(PACKAGE): XCPPFLAGS += -I/usr/local/include
164 $(PACKAGE): XLDFLAGS += -L/usr/local/lib
165 else ifeq ($(OS_NAME),NetBSD)
166 $(PACKAGE): XCPPFLAGS += -I/usr/pkg/include
167 $(PACKAGE): XLDFLAGS += -L/usr/pkg/lib
168 endif
169 ifeq ($(findstring $(OS_NAME),FreeBSD DragonFly NetBSD OpenBSD),)
170 $(PACKAGE): XCPPFLAGS += -D_XOPEN_SOURCE=600
171 endif
173 $(PACKAGE): $($(PACKAGE)_OBJS)
174 $(LINK.o) $^ $(LDLIBS) -o $@
176 $(PACKAGE)-prefs: $($(PACKAGE)-prefs_OBJS)
177 $(LINK.o) $^ $(LDLIBS) -o $@
179 %-resources.c: %.gresource.xml
180 $(GLIB_COMPILE_RESOURCES) --generate-dependencies $< | \
181 while read -r resource_file; do \
182 printf '%s: %s\n' $@ "$${resource_file}"; \
183 done
184 $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=. --generate-source $<
186 $(POTFILE): po/POTFILES.in $(POTFILES_IN)
187 $(XGETTEXT) $(XGETTEXT_OPTIONS) --files-from $< --output $@
189 pot: $(POTFILE)
191 update-po: $(POTFILE)
192 for pofile in $(patsubst %.mo,%.po,$(MOFILES)); do \
193 $(MSGMERGE) --update --backup off $$pofile $<; \
194 done
196 %.mo: %.po
197 $(MSGFMT) --output $@ $<
199 %.desktop: %.desktop.in
200 $(MSGFMT) --desktop --template $< -d po --output $@
202 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
204 %.o: %.c
205 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
206 $(COMPILE.c) -o $@ $<
208 install: all
209 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
210 $(INSTALL.exec) $(PACKAGE)-prefs \
211 "$(DESTDIR)$(bindir)/$(PACKAGE)-prefs"
212 for schema in $(GSETTINGS_SCHEMAS); do \
213 $(INSTALL.data) $${schema} \
214 $(DESTDIR)$(datadir)/glib-2.0/schemas/$${schema}; \
215 done
216 [ -n "$(GSETTINGS_SCHEMAS)" ] && \
217 $(GLIB_COMPILE_SCHEMAS) $(datadir)/glib-2.0/schemas
218 $(INSTALL.data) $(AUTOSTART_FILE) \
219 $(DESTDIR)$(xdgautostartdir)/$(AUTOSTART_FILE)
220 for desktop_file in $(DESKTOP_FILES); do \
221 $(INSTALL.data) $${desktop_file} \
222 $(DESTDIR)$(xdgapplicationsdir)/$${desktop_file}; \
223 done
224 for lang in $(LINGUAS); do \
225 $(INSTALL.data) po/$${lang}.mo \
226 $(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo; \
227 done
228 for manpage in $(MANPAGES); do \
229 $(INSTALL.data) $${manpage} \
230 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
231 done
233 clean:
234 rm -f $(PACKAGE) $(OBJS) $(AUTOSTART_FILE) $(DESKTOP_FILES) $(POTFILE) \
235 $(MOFILES) $(MANPAGES)
237 clobber: clean
238 rm -f $(patsubst %.o,%.d,$(OBJS))
240 dist: clobber
241 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \
242 -s ',^\.$$,,' -s ',\./,$(DISTNAME)/,' . | \
243 $(GZIP) > $(DISTNAME).tar.gz
245 -include local.mk
247 -include $(patsubst %.o,%.d,$(OBJS))
248 -include $(patsubst %.gresource.xml,%.gresource.d,$(GRESOURCE_FILES))