]> git.lizzy.rs Git - micro.git/blob - tools/build-deb.sh
Merge branch 'master' of https://github.com/zyedidia/micro into build_tools
[micro.git] / tools / build-deb.sh
1 # Builds two .deb packages, for x86 (i386) and x86_64 (amd64)
2 # These packages are the bare minimum, which means that they can be installed
3 # But they do not feature everything yet.
4 # This does not mean that the editor itself is affected.
5
6 function getControl() {
7 echo Section: editors
8 echo Package: micro
9 echo Version: $2
10 echo Priority: extra
11 echo Maintainer: \"Zachary Yedidia\" \<zyedidia@gmail.com\>
12 echo Standards-Version: 3.9.8
13 echo Homepage: https://micro-editor.github.io/
14 echo Architecture: $1
15 echo "Description: A modern and intuitive terminal-based text editor"
16 echo " This package contains a modern alternative to other terminal-based"
17 echo " Editors. It is easy to Use, highly customizable via themes and plugins"
18 echo " and it supports mouse input"
19 }
20
21 function installFiles() {
22   TO="$1/$2/usr/share/doc/micro/"
23   mkdir -p $TO
24   cp ../LICENSE $TO
25   cp ../LICENSE-THIRD-PARTY $TO
26   cp ../README.md $TO
27   gzip -c ../assets/packaging/micro.1 > $1/$2/usr/share/man/man1/micro.1.gz
28   cp ../assets/packaging/micro.desktop $1/$2/usr/share/applications/
29   cp ../assets/logo.svg $1/$2/usr/share/icons/micro.svg
30 }
31
32 version=$1
33 if [ "$1" == "" ]
34 then
35   version=$(go run build-version.go)
36 fi
37 echo "Building packages for Version '$version'"
38 echo "Running Cross-Compile"
39 ./cross-compile.sh $version
40
41 echo "Beginning package build process"
42
43 PKGPATH="../packages/deb"
44
45 rm -fr $PKGPATH
46 mkdir -p $PKGPATH/amd64/DEBIAN/
47 mkdir -p $PKGPATH/i386/DEBIAN/
48
49 getControl "amd64" "$version" > $PKGPATH/amd64/DEBIAN/control
50 tar -xzf "../binaries/micro-$version-linux64.tar.gz" "micro-$version/micro"
51 mkdir -p $PKGPATH/amd64/usr/local/bin/
52 mv "micro-$version/micro" "$PKGPATH/amd64/usr/local/bin/"
53
54 getControl "i386" "$version" > $PKGPATH/i386/DEBIAN/control
55 tar -xzf "../binaries/micro-$version-linux32.tar.gz" "micro-$version/micro"
56 mkdir -p $PKGPATH/i386/usr/local/bin/
57 mv "micro-$version/micro" "$PKGPATH/i386/usr/local/bin/"
58
59 rm -rf "micro-$version"
60
61 installFiles $PKGPATH "amd64"
62 installFiles $PKGPATH "i386"
63
64 dpkg -b "$PKGPATH/amd64/" "../packages/micro-$version-amd64.deb"
65 dpkg -b "$PKGPATH/i386/" "../packages/micro-$version-i386.deb"