source: Makefile

Last change on this file was 6260bcd, checked in by Martin Kolman <martin.kolman@…>, 3 months ago

Use appropriately styled icons on Sailfish OS

Thanks a lot to Amboss for creating the nice Sailfish OS styled modRana icon! :)

  • Property mode set to 100644
File size: 5.9 KB
Line 
1PKGNAME=modrana
2VERSION=$(shell awk '/Version:/ { print $$2 }' packaging/$(PKGNAME).spec)
3RELEASE=$(shell awk '/Release:/ { print $$2 }' packaging/$(PKGNAME).spec | sed -e 's|%.*$$||g')
4TAG=modrana-$(VERSION)
5
6PYTHON2=python2
7PYTHON3=python3
8PYTHON=$(PYTHON2)
9
10RSYNC=rsync
11
12SOURCEDIR=modrana_source
13BUILDDIR=modrana_build
14EXCLUDEFILE=packaging/fedora/exclude.txt
15EXCLUDESAILFISH=packaging/sailfish/exclude.txt
16# lists a few additional items to exclude for Harbour packages
17EXCLUDEHARBOUR=packaging/sailfish/exclude_harbour.txt
18
19DESTDIR=/
20
21default: all
22
23all:
24        rm -rf $(SOURCEDIR)
25        rm -rf $(BUILDDIR)
26        mkdir $(SOURCEDIR)
27        mkdir $(BUILDDIR)
28        cp -r core $(SOURCEDIR)
29        cp -r data $(SOURCEDIR)
30        cp -r modules $(SOURCEDIR)
31        cp -r run $(SOURCEDIR)
32        cp -r themes $(SOURCEDIR)
33        cp -r modrana.py $(SOURCEDIR)
34        cp -r version.txt $(SOURCEDIR)
35
36rsync:
37        # cleanup the source tree
38        $(RSYNC) -ar --exclude-from $(EXCLUDEFILE) $(SOURCEDIR)/ $(BUILDDIR)
39
40rsync-sailfish: sailfish-qml-mangle
41        # cleanup the source tree for a Sailfish OS package
42        $(RSYNC) -ar --exclude-from $(EXCLUDESAILFISH) $(SOURCEDIR)/ $(BUILDDIR)
43
44rsync-harbour: sailfish-qml-mangle
45        # first mark modrana.py as not executable as Harbour RPM validator does not like that
46        # for some reason (not like you could not just run it with python3 modrana.py...)
47        chmod -x $(SOURCEDIR)/modrana.py
48        # also mark the startup scripts as not executable to make the Harbour RPM validator happy
49        chmod -x $(SOURCEDIR)/run/*
50
51        # cleanup the source for a Sailfish OS Harbour package
52        $(RSYNC) -ar --exclude-from $(EXCLUDESAILFISH) --exclude-from $(EXCLUDEHARBOUR) $(SOURCEDIR)/ $(BUILDDIR)
53
54clean:
55        -rm *.tar.gz
56        rm -rf $(SOURCEDIR)
57        rm -rf $(BUILDDIR)
58
59sailfish-qml-mangle:
60        bash packaging/sailfish/sailfish_qml_mangle.sh $(SOURCEDIR)
61
62bytecode-python2:
63        -python2 -m compileall $(BUILDDIR)
64
65bytecode-python3:
66        -python3 -m compileall $(BUILDDIR)
67
68install:
69        -mkdir -p $(DESTDIR)/usr/share/modrana
70        cp -r $(BUILDDIR)/* $(DESTDIR)/usr/share/modrana
71        # install *all* available icons - just in case :)
72        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor
73        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor/48x48/apps
74        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor/64x64/apps
75        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor/128x128/apps
76        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor/256x256/apps
77        cp packaging/icons/modrana/48x48/modrana.png $(DESTDIR)/usr/share/icons/hicolor/48x48/apps/
78        cp packaging/icons/modrana/64x64/modrana.png $(DESTDIR)/usr/share/icons/hicolor/64x64/apps/
79        cp packaging/icons/modrana/128x128/modrana.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/
80        cp packaging/icons/modrana/256x256/modrana.png $(DESTDIR)/usr/share/icons/hicolor/256x256/apps/
81        cp packaging/fedora/modrana-qml.png $(DESTDIR)/usr/share/icons/hicolor/64x64/apps/
82        # install the desktop file
83        -mkdir -p $(DESTDIR)/usr/share/applications/
84        cp packaging/fedora/modrana.desktop $(DESTDIR)/usr/share/applications/
85        cp packaging/fedora/modrana-qt5.desktop $(DESTDIR)/usr/share/applications/
86        # install the startup scripts
87        -mkdir -p $(DESTDIR)/usr/bin
88        cp packaging/fedora/modrana $(DESTDIR)/usr/bin/
89        cp packaging/fedora/modrana-gtk $(DESTDIR)/usr/bin/
90        cp packaging/fedora/modrana-qt5 $(DESTDIR)/usr/bin/
91
92install-sailfish:
93        -mkdir -p $(DESTDIR)/usr/share/harbour-modrana
94        cp -r $(BUILDDIR)/* $(DESTDIR)/usr/share/harbour-modrana
95        # install the icons
96        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor/86x86/apps/
97        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor/108x108/apps/
98        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/
99        -mkdir -p $(DESTDIR)/usr/share/icons/hicolor/256x256/apps/
100        cp packaging/icons/modrana-sailfish/86x86/harbour-modrana.png $(DESTDIR)/usr/share/icons/hicolor/86x86/apps/
101        cp packaging/icons/modrana-sailfish/108x108/harbour-modrana.png $(DESTDIR)/usr/share/icons/hicolor/108x108/apps/
102        cp packaging/icons/modrana-sailfish/128x128/harbour-modrana.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/
103        cp packaging/icons/modrana-sailfish/256x256/harbour-modrana.png $(DESTDIR)/usr/share/icons/hicolor/256x256/apps/
104        # install the desktop file
105        -mkdir -p $(DESTDIR)/usr/share/applications/
106        cp packaging/sailfish/harbour-modrana.desktop $(DESTDIR)/usr/share/applications/
107       
108tag:
109        git tag -a -m "Tag as $(TAG)" -f $(TAG)
110        @echo "Tagged as $(TAG)"
111
112archive: tag local
113
114local:
115        @rm -f ChangeLog
116        @make ChangeLog
117        @make VersionFile
118        git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(TAG) > $(PKGNAME)-$(VERSION).tar
119        mkdir -p $(PKGNAME)-$(VERSION)
120        cp ChangeLog $(PKGNAME)-$(VERSION)/
121        cp version.txt $(PKGNAME)-$(VERSION)/
122        tar -rf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION)
123        gzip -9 $(PKGNAME)-$(VERSION).tar
124        rm -rf $(PKGNAME)-$(VERSION)
125        @echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
126
127rpmlog:
128        @git log --pretty="format:- %s (%ae)" $(TAG).. |sed -e 's/@.*)/)/'
129        @echo
130
131ChangeLog:
132        (GIT_DIR=.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
133
134VersionFile:
135        echo $(VERSION) > version.txt
136
137bumpver:
138        @NEWSUBVER=$$((`echo $(VERSION) |cut -d . -f 3` + 1)) ; \
139        NEWVERSION=`echo $(VERSION).$$NEWSUBVER |cut -d . -f 1,2,4` ; \
140        DATELINE="* `LANG=c date "+%a %b %d %Y"` `git config user.name` <`git config user.email`> - $$NEWVERSION-1"  ; \
141        cl=`grep -n %changelog packaging/modrana.spec |cut -d : -f 1` ; \
142        tail --lines=+$$(($$cl + 1)) packaging/modrana.spec > speclog ; \
143        (head -n $$cl packaging/modrana.spec ; echo "$$DATELINE" ; make --quiet rpmlog 2>/dev/null ; echo ""; cat speclog) > packaging/modrana.spec.new ; \
144        mv packaging/modrana.spec.new packaging/modrana.spec ; rm -f speclog ; \
145        sed -i "s/Version: $(VERSION)/Version: $$NEWVERSION/" packaging/modrana.spec ; \
146
147.PHONY: clean install tag archive local
148
149test:
150        # use a nested whell to resolve path to nosetests and run the path with python3
151        # so that we don't need to change the executable name every time major version
152        # of Python changes in the distro
153        python3 `which nosetests` -w tests -v
Note: See TracBrowser for help on using the repository browser.