zip-binaries.sh 1.71 KB
Newer Older
Jaromil's avatar
Jaromil committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env zsh

[[ -r ../VERSION ]] || {
	print "$0: launch from build directory"
	return 1 }

VERSION=`cat ../VERSION`

targets=(windows apple linux javascript)

function checkbin() {
	[[ -r $1 ]] && {
		mkdir -p $2
		cp -v $1 $2
		chmod +x $2/$1
		cp ../LICENSE.txt $2
		cp ../README.md $2
		cp ../ChangeLog.md $2
		return 0
	}
21
	print "file not found: $1"
Jaromil's avatar
Jaromil committed
22
23
24
25
26
27
28
29
30
31
	return 1
}

function checkdir() {
	[[ -d $1 ]] && {
		mkdir -p $2/$1
		cp -v $1/* $2/$1/
		cp ../LICENSE.txt $2
		cp ../README.md $2
		cp ../ChangeLog.md $2
32
		rsync -raX ../examples $2/
Jaromil's avatar
Jaromil committed
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
		return 0
	}
	print "directory not found: $1"
	return 1
}

for t in $targets; do
	dir=Zenroom-$VERSION-$t
	rm -rf $dir
	print "zipping $t binaries..."
	case $t in
		windows)
			checkbin zenroom.exe $dir
			checkbin zenroom.dll $dir
			continue ;;
		apple)
			checkbin zenroom.command $dir
			checkbin zenroom-ios.a $dir
			continue ;;
		linux)
			checkbin zenroom.x86 $dir
			checkbin zenroom.armhf $dir
Jaromil's avatar
Jaromil committed
55
56
57
58
59
			checkbin python2       $dir
			checkbin python3       $dir
			checkbin go            $dir
			checkbin zenroom-wrapper.py $dir/python2
			checkbin zenroom-wrapper.py $dir/python3
60
			checkbin libzenroomgo.so $dir
Jaromil's avatar
Jaromil committed
61
62
63
64
			continue ;;
		javascript)
			checkdir nodejs $dir
			checkdir wasm   $dir
Jaromil's avatar
Jaromil committed
65
			checkdir rnjs   $dir
Jaromil's avatar
Jaromil committed
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
			checkbin nodejs/zenroom.js.mem $dir
			checkbin zenroom_exec.js $dir
			continue ;;
	esac
done

for t in $targets; do
	[[ -d Zenroom-$VERSION-$t ]] || {
		print "missing archive: Zenroom-$VERSION-$t.zip"
		continue }
	rm -f Zenroom-$VERSION-$t.zip
	print  "Zenroom $VERSION by Dyne.org Foundation." |
		zip -r -9 -z \
			Zenroom-$VERSION-$t.zip Zenroom-$VERSION-$t \
			>/dev/null
	ls -lh Zenroom-$VERSION-$t.zip
done

sha256sum Zenroom-$VERSION*zip > Zenroom-$VERSION-checksums.txt