This repository has been archived by the owner on Sep 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·72 lines (63 loc) · 2.24 KB
/
build
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
#!/bin/sh
#
# Builds a Debian package for MXNET by fetching the library from the upstream
# repo.
#
# Copyright sociomantic labs GmbH 2017.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set -xeu
# Arguments:
# ref - Git reference to build, normally it should be a tag
# pkg_build - Debian package build
test -n "$1"
test -n "$2"
ref="$1"
pkg_build="$2"
# Clone the repo and check out the ref we want
git clone -b "${ref}" --depth 50 https://github.com/dmlc/mxnet.git
cd mxnet
git submodule update --init --recursive
# if the requested build identifier matches a git tag, use that directly,
# otherwise use git revision description (note, we implicitly assume that all
# tags and revision descriptions will begin with `v`)
versiontag=$([ "${ref}" = "$(git tag -l ${ref} --contains HEAD)" ] \
&& echo "${ref}" \
|| echo "$(git describe)")
# Set up package
pkgname=libmxnet
pkgversion_number=$(echo "${versiontag}" | sed 's/^v\(.*\)$/\1/' ) # remove any initial `v`
pkgbuild="${pkg_build}"
pkgdistro=$(lsb_release -cs)
pkgversion="${pkgversion_number}-${pkgbuild}~${pkgdistro}"
pkgmaintainer="Sociomantic Tsunami <[email protected]>"
DEB_HOST_MULTIARCH=x86_64-linux-gnu
genchangelog()
{
echo "$1 ($2) $(lsb_release -sc); urgency=low"
echo
prevtag=$(git describe --abbrev=0 HEAD^)
git log --date=short --format=" * %s (%h, $cd)" "$prevtag"..HEAD |
fold --spaces --width 76 | sed 's/^\([^ ]\+\)/ \1/'
echo
echo " -- $3 `LANG=C date -R`"
}
make USE_BLAS=openblas USE_OPENCV=0 USE_OPENMP=0
changelog=`mktemp`
genchangelog "$pkgname" "$pkgversion" "$pkgmaintainer" > "$changelog"
cd -
fpm -s dir -t deb -n "$pkgname" -v "$pkgversion" \
--maintainer "$pkgmaintainer" \
--description "Lightweight, portable deep learning library" \
--url 'https://github.com/dmlc/mxnet' \
--vendor 'Distributed (Deep) Machine Learning Community' \
--license 'Apache License, Version 2.0' \
--category libs \
--depends libc6 \
--depends libstdc++6 \
--depends libopenblas-base \
--deb-changelog "$changelog" \
--deb-no-default-config-files \
mxnet/lib/libmxnet.a=/usr/lib/ \
mxnet/lib/libmxnet.so=/usr/lib/