forked from xmake-io/xmake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakepkg
executable file
·65 lines (55 loc) · 1.4 KB
/
makepkg
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
#!/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 1 ]; then
echo "Usage: ./scripts/makepkg [rpm|deb|osxpkg|pacman]"
exit
fi
xmakeroot=`pwd`
artifactsdir=$xmakeroot/artifacts
if [ ! -d $artifactsdir ]; then
mkdir $artifactsdir
fi
# target
target=$1
# version
version=`cat ./core/xmake.lua | grep -E "^set_version" | grep -oE "[0-9]*\.[0-9]*\.[0-9]*"`
# 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
./configure
make
# make dep package using fpm
fpm -s dir -t $target -n xmake -v $version -m "<[email protected]>" --description "A cross-platform build utility based on Lua" --url "xmake.io" --license Apache \
xmake=/usr/local/share/ \
build/xmake=/usr/local/bin/xmake \
scripts/xrepo.sh=/usr/local/bin/xrepo
if [ "$target" == "osxpkg" ]; then
mv "xmake-$version.pkg" "$artifactsdir/xmake.pkg"
elif [ "$target" == "deb" ]; then
mv "xmake_${version}_amd64.deb" "$artifactsdir/xmake.deb"
fi