summaryrefslogtreecommitdiff
path: root/scripts/makepkg
blob: 6c2bd1348e70088de526aefa0852675e28a3b860 (plain)
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
#!/usr/bin/env bash

# install fpm
#
# On OSX/macOS:
# brew install gnu-tar
#
# On Red Hat systems (Fedora 22 or older, CentOS, etc):
# yum install ruby-devel gcc make rpm-build
#
# On Fedora 23 or newer:
# dnf install ruby-devel gcc make rpm-build
#
# On Debian-derived systems (Debian, Ubuntu, etc):
# apt-get install ruby ruby-dev rubygems gcc make
#
# Installing FPM:
# gem install --no-ri --no-rdoc fpm
#

# check
if [ $# -lt 2 ]; then
    echo "Usage: ./scripts/makepkg [rpm|deb|osxpkg|pacman] [version]"
    exit
fi

# target
target=$1

# version
version=$2

# arch
arch=i386
if [ `getconf LONG_BIT` == "64" ]; then
    arch=x86_64
fi

# platform
plat=linux
if [ `uname` == "Darwin" ]; then
    plat=macosx
fi

# build first
make build

# make xmake wrapper
echo "#/!bin/bash
export XMAKE_PROGRAM_DIR=/usr/local/share/xmake
/usr/local/share/xmake/xmake \"\$@\"
" > /tmp/xmake.sh
chmod 755 /tmp/xmake.sh

# make dep package using fpm
fpm -s dir -t $target -n xmake -v $version -m "<[email protected]>" --description "A make-like build utility based on Lua" --url "xmake.io" --license Apache \
        xmake=/usr/local/share/ \
        core/src/demo/demo.b=/usr/local/share/xmake/xmake \
        /tmp/xmake.sh=/usr/local/bin/xmake