-
Notifications
You must be signed in to change notification settings - Fork 2
/
make-package.sh
executable file
·110 lines (87 loc) · 3.5 KB
/
make-package.sh
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# set up essential stuff
CONFIG_FILE="make-package.cfg"
CONFLICTS="oscript"
DESCRIPTION="Is an interpreter, debugger & package manager for the Slang programming language"
MAINTAINER="Michael Adelmann <michael.adelmann@gmail.com>"
PACKAGE="slang"
#PLATFORM=$(uname -m)
PLATFORM="any"
PROVIDES="slang"
REPLACES="oscript"
VERSION=$(cat version)
# preparing config file if necessary
if [[ -f ${CONFIG_FILE} ]]; then
test -f ${CONFIG_FILE}
else
echo "Preparing config file '${CONFIG_FILE}', please edit manually before proceeding."
cp ${CONFIG_FILE}.tmp ${CONFIG_FILE}
exit 255
fi
# read config file
source ${CONFIG_FILE}
if [[ "x${1}" != "x" ]]; then
PLATFORM=${1}
#else
# PLATFORM="any"
fi
# set up environment
PACKAGE_DIRECTORY="${TARGET_DIRECTORY}/slang-${VERSION}-${PLATFORM}"
PACKAGE_DIRECTORY_BIN="${PACKAGE_DIRECTORY}/usr/local/bin"
PACKAGE_DIRECTORY_SHARE="${PACKAGE_DIRECTORY}/usr/local/share/slang"
PACKAGE_DIRECTORY_SHARED_LIBRARIES="${PACKAGE_DIRECTORY_SHARE}/libs"
PACKAGE_DIRECTORY_LIBRARY="${PACKAGE_DIRECTORY_SHARE}/Library"
echo "Building Slang debian package version ${VERSION} for platform '${PLATFORM}'..."
echo ""
#echo "Removing old package directory."
rm -r "${PACKAGE_DIRECTORY}" 2>&1
echo "Creating package directories '${PACKAGE_DIRECTORY}'."
#echo "PACKAGE_DIRECTORY='${PACKAGE_DIRECTORY}'"
#echo "PACKAGE_DIRECTORY_BIN='${PACKAGE_DIRECTORY_BIN}'"
#echo "PACKAGE_DIRECTORY_LIBRARY='${PACKAGE_DIRECTORY_LIBRARY}'"
echo ""
mkdir -p "${PACKAGE_DIRECTORY}"
mkdir -p "${PACKAGE_DIRECTORY_BIN}"
mkdir -p "${PACKAGE_DIRECTORY_SHARED_LIBRARIES}"
mkdir -p "${PACKAGE_DIRECTORY_LIBRARY}"
# copying DEBIAN base structure
cp -r Env/DEBIAN "${PACKAGE_DIRECTORY}"
touch Env/DEBIAN/control
echo "Source: ${PACKAGE}" > Env/DEBIAN/control
echo "Section: unknown" >> Env/DEBIAN/control
echo "Priority: optional" >> Env/DEBIAN/control
echo "Maintainer: ${MAINTAINER}" >> Env/DEBIAN/control
echo "Build-Depends: debhelper (>=10), libsqlite3-dev" >> Env/DEBIAN/control
echo "Standards-Version: 4.0.0" >> Env/DEBIAN/control
echo "Homepage: https://slang.ticketsharing.net/" >> Env/DEBIAN/control
echo "Package: ${PACKAGE}" >> Env/DEBIAN/control
echo "Version: ${VERSION}" >> Env/DEBIAN/control
echo "Architecture: ${PLATFORM}" >> Env/DEBIAN/control
echo "Conficts: ${CONFLICTS}" >> Env/DEBIAN/control
echo "Provides: ${PROVIDES}" >> Env/DEBIAN/control
echo "Replaces: ${REPLACES}" >> Env/DEBIAN/control
#echo "Depends: \"${shlibs:Depends}\", \"${misc:depends}\"" >> Env/DEBIAN/control
echo "Description: ${DESCRIPTION}" >> Env/DEBIAN/control
# add new binaries
echo "Deploying new binaries..."
cp "${SOURCE_DIRECTORY}/slang/slang" "${PACKAGE_DIRECTORY_BIN}"
cp "${SOURCE_DIRECTORY}/slang-dbg/slang-dbg" "${PACKAGE_DIRECTORY_BIN}"
cp "${SOURCE_DIRECTORY}/slang-pkg/slang-pkg" "${PACKAGE_DIRECTORY_BIN}"
# add new scripts
echo "Deploying new scripts..."
cp "${SCRIPTS_DIRECTORY}/webscript" "${PACKAGE_DIRECTORY_BIN}"
# add new libraries
echo "Deploying new libraries..."
cp -r Projects/Library/Slang "${PACKAGE_DIRECTORY_LIBRARY}"
cp -r Projects/Library/System "${PACKAGE_DIRECTORY_LIBRARY}"
# add new shared libraries
echo "Deploying new shared libraries..."
cp "${EXTENSIONS_DIRECTORY}"/lib* "${PACKAGE_DIRECTORY_SHARED_LIBRARIES}"
# add symlink from slang to oscript for legacy scripts
ln -s "slang" "${PACKAGE_DIRECTORY_BIN}/oscript"
ln -s "slang-dbg" "${PACKAGE_DIRECTORY_BIN}/odebugger"
ln -s "slang-pkg" "${PACKAGE_DIRECTORY_BIN}/odepend"
echo ""
echo "Building package..."
dpkg-deb --build "${PACKAGE_DIRECTORY}" > /dev/null
echo "Done."