-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
100 lines (78 loc) · 2.82 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
.PHONY: windows
VERSION = 0.9.6
all:
go build -o ./decker ./src
32:
GOARCH=386 \
go build -o ./decker ./src
install:
cp ./decker /usr/bin/decker
cp ./misc/decker.desktop /usr/share/applications/
cp ./misc/mime.xml /usr/share/mime/packages/
cp ./misc/icon.png /usr/share/pixmaps/decker.png
update-mime-database /usr/share/mime/
update-desktop-database
update:
cp ./decker /usr/bin/decker
windows:
cp ./misc/rsrc.syso ./src/rsrc.syso
GOOS=windows \
GOARCH=386 \
go build -o ./decker.exe ./src
rm ./src/rsrc.syso
zip:
GOOS=windows \
GOARCH=386 \
go build -o ./pkg/zip/windows/decker.exe ./src
rm -f ./pkg/zip/decker-$(VERSION).zip
find . -name "*.deck" -print | zip ./pkg/zip/decker-$(VERSION).zip -@
find . -name "montage.exe" -print | zip ./pkg/zip/decker-$(VERSION).zip -@
find . -name "vcomp100.dll" -print | zip ./pkg/zip/decker-$(VERSION).zip -@
cd ./pkg/zip/windows/ && find . -print | zip ../decker-$(VERSION).zip -@
deb:
#Create the folders.
GOARCH=386 \
go build -o ./pkg/deb/decker ./src
mkdir -p ./pkg/deb/DEBIAN
cp ./misc/version.info ./pkg/deb/DEBIAN/control
if file decker | grep "64-bit"; then \
sed "s/ARCHITECTURE/amd64/" -i ./pkg/deb/DEBIAN/control; fi
if file decker | grep "32-bit"; then \
sed "s/ARCHITECTURE/i386/" -i ./pkg/deb/DEBIAN/control; fi
sed "s/VERSION/$(VERSION)/" -i ./pkg/deb/DEBIAN/control
echo "#!/bin/sh -e\nupdate-desktop-database" >> ./pkg/deb/DEBIAN/postinst
chmod +x ./pkg/deb/DEBIAN/postinst
echo "2.0" > ./pkg/deb/debian-binary
mkdir -p ./pkg/deb/sysroot/usr/bin/
mkdir -p ./pkg/deb/sysroot/usr/share/applications/
mkdir -p ./pkg/deb/sysroot/usr/share/mime/packages/
mkdir -p ./pkg/deb/sysroot/usr/share/pixmaps/
#Copy files.
cp ./pkg/deb/decker ./pkg/deb/sysroot/usr/bin/
chmod +x ./pkg/deb/sysroot/usr/bin/decker
cp ./misc/decker.desktop ./pkg/deb/sysroot/usr/share/applications/
cp ./misc/mime.xml ./pkg/deb/sysroot/usr/share/mime/packages/
cp ./misc/icon.png ./pkg/deb/sysroot/usr/share/pixmaps/decker.png
sed "s/SIZE/$(shell stat -c %s ./pkg/deb)/" -i ./pkg/deb/DEBIAN/control
#Permissions.
find ./pkg/deb/ -type d -exec chmod 0755 {} \;
find ./pkg/deb/ -type f -exec chmod go-w {} \;
chown -R root:root ./pkg/deb/
cd ./pkg/deb/sysroot/ && tar czf ../data.tar.gz *
cd ./pkg/deb/DEBIAN/ && tar czf ../control.tar.gz *
find ./pkg/deb/ -type d -exec chmod 0755 {} \;
find ./pkg/deb/ -type f -exec chmod go-w {} \;
chown -R root:root ./pkg/deb/
#Clean up and build.
rm -rf ./pkg/deb/sysroot
rm -rf ./pkg/deb/DEBIAN
cd ./pkg/deb/ && ar r decker-$(VERSION).deb debian-binary control.tar.gz data.tar.gz
rm -f ./pkg/deb/control.tar.gz
rm -f ./pkg/deb/data.tar.gz
rm -f ./pkg/deb/decker
rm -f ./pkg/deb/debian-binary
find ./pkg/deb/ -type d -exec chmod 0777 {} \;
find ./pkg/deb/ -type f -exec chmod go-w {} \;
release:
make zip
make deb