forked from microsoft/msquic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-packages.sh
More file actions
executable file
·216 lines (200 loc) · 5.81 KB
/
Copy pathmake-packages.sh
File metadata and controls
executable file
·216 lines (200 loc) · 5.81 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#!/bin/bash
usage()
{
echo "Usage: $0 [-output <directory>] [-config Debug]"
exit 1
}
OS=$(uname)
ARCH=$(uname -m)
PKGARCH=${ARCH}
FPM=`which fpm` 2>/dev/null
CONFIG=Release
NAME=libmsquic
TLS=openssl
TLSVERSION=1.1
CONFLICTS=
DESCRIPTION="Microsoft implementation of the IETF QUIC protocol"
VENDOR="Microsoft"
MAINTAINER="Microsoft QUIC Team <quicdev@microsoft.com>"
VER_MAJOR=$(cat ./src/inc/msquic.ver | grep 'define VER_MAJOR'| cut -d ' ' -f 3)
VER_MINOR=$(cat ./src/inc/msquic.ver | grep 'define VER_MINOR'| cut -d ' ' -f 3)
VER_PATCH=$(cat ./src/inc/msquic.ver | grep 'define VER_PATCH'| cut -d ' ' -f 3)
if [ -z "$FPM" ]; then
echo Install 'fpm'
exit 1
fi
if [ "$OS" == 'Linux' ]; then
OS=linux
LIBEXT=so
if [ "$ARCH" == 'x86_64' ]; then
ARCH='x64'
LIBDIR="lib64"
else
LIBDIR="lib"
if [ "$ARCH" == "aarch64" ]; then
ARCH=arm64
else
if [ "$ARCH" == "armv7l" ]; then
ARCH=arm
else
ARCH=x86
fi
fi
fi
else
if [ "$OS" == 'Darwin' ]; then
OS=macos
ARCH=x64
LIBEXT=dylib
else
echo Only Linux and macOS packaging is supported at the moment.
exit 1
fi
fi
# process arguments and allow to override default values
while :; do
if [ $# -le 0 ]; then
break
fi
lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")"
case $lowerI in
-a|-arch|--arch)
shift
ARCH=$1
if [ "$ARCH" == 'arm64' ]; then
PKGARCH=aarch64
fi
if [ "$ARCH" == 'arm' ]; then
PKGARCH=armhf
fi
;;
-d|-debug|--debug)
CONFIG=Debug
;;
-c|-config|--config)
shift
CONFIG=$1
;;
-o|-output|--output)
shift
OUTPUT=$1
;;
-t|-tls|--tls)
shift
TLS=$1
case $TLS in
'openssl')
;;
'openssl3')
TLSVERSION=3
;;
*)
echo "Unknown TLS version '$TLS'."
exit 1
esac
;;
-\?|-h|--help)
usage
exit 1
;;
*)
echo unknown argument
;;
esac
shift
done
if [ ${CONFIG} != 'Release' ]; then
NAME=libmsquic-debug
CONFLICTS='libmsquic'
else
CONFLICTS='libmsquic-debug'
fi
ARTIFACTS="artifacts/bin/${OS}/${ARCH}_${CONFIG}_${TLS}"
if [ -z ${OUTPUT} ]; then
OUTPUT="artifacts/packages/${OS}/${ARCH}_${CONFIG}_${TLS}"
fi
echo "ARCH=$ARCH PKGARCH=$PKGARCH ARTIFACTS=$ARTIFACTS"
mkdir -p ${OUTPUT}
if [ "$OS" == "linux" ]; then
# RedHat/CentOS
FILES="${ARTIFACTS}/libmsquic.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}=/usr/${LIBDIR}/libmsquic.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}"
FILES="${FILES} ${ARTIFACTS}/libmsquic.${LIBEXT}.${VER_MAJOR}=/usr/${LIBDIR}/libmsquic.${LIBEXT}.${VER_MAJOR}"
if [ -e "$ARTIFACTS/libmsquic.lttng.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}" ]; then
FILES="${FILES} ${ARTIFACTS}/libmsquic.lttng.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}=/usr/${LIBDIR}/libmsquic.lttng.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}"
fi
if [ "$PKGARCH" == 'aarch64' ] || [ "$PKGARCH" == 'x86_64' ]; then
BITS='64bit'
fi
fpm \
--force \
--input-type dir \
--output-type rpm \
--architecture ${PKGARCH} \
--name ${NAME} \
--provides ${NAME} \
--depends "libcrypto.so.${TLSVERSION}()(${BITS})" \
--depends "libnuma.so.1()(${BITS})" \
--conflicts ${CONFLICTS} \
--version ${VER_MAJOR}.${VER_MINOR}.${VER_PATCH} \
--description "${DESCRIPTION}" \
--vendor "${VENDOR}" \
--maintainer "${MAINTAINER}" \
--package "${OUTPUT}" \
--license MIT \
--url https://github.com/microsoft/msquic \
--log error \
${FILES}
# Debian/Ubuntu
if [ "$ARCH" == 'x64' ]; then
LIBDIR="lib/x86_64-linux-gnu"
fi
if [ "$ARCH" == 'arm64' ];then
LIBDIR="lib/aarch64-linux-gnu"
fi
if [ "$ARCH" == 'arm' ];then
LIBDIR="lib/arm-linux-gnueabihf"
fi
FILES="${ARTIFACTS}/libmsquic.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}=/usr/${LIBDIR}/libmsquic.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}"
FILES="${FILES} ${ARTIFACTS}/libmsquic.${LIBEXT}.${VER_MAJOR}=/usr/${LIBDIR}/libmsquic.${LIBEXT}.${VER_MAJOR}"
if [ -e "$ARTIFACTS/libmsquic.lttng.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}" ]; then
FILES="${FILES} ${ARTIFACTS}/libmsquic.lttng.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}=/usr/${LIBDIR}/libmsquic.lttng.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}"
fi
fpm \
--force \
--input-type dir \
--output-type deb \
--architecture ${PKGARCH} \
--name ${NAME} \
--provides ${NAME} \
--conflicts ${CONFLICTS} \
--depends "libssl${TLSVERSION}" \
--depends "libnuma1" \
--version ${VER_MAJOR}.${VER_MINOR}.${VER_PATCH} \
--description "${DESCRIPTION}" \
--vendor "${VENDOR}" \
--maintainer "${MAINTAINER}" \
--package "${OUTPUT}" \
--license MIT \
--url https://github.com/microsoft/msquic \
--log error \
${FILES}
fi
# macOS
if [ "$OS" == "macos" ]; then
fpm \
--force \
--input-type dir \
--output-type osxpkg \
--name ${NAME} \
--provides ${NAME} \
--conflicts ${CONFLICTS} \
--version ${VER_MAJOR}.${VER_MINOR}.${VER_PATCH} \
--description "${DESCRIPTION}" \
--vendor "${VENDOR}" \
--maintainer "${MAINTAINER}" \
--package "${OUTPUT}" \
--license MIT \
--url https://github.com/microsoft/msquic \
--log error \
"$ARTIFACTS/libmsquic.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}.dylib"=/usr/local/lib/libmsquic.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}.dylib
fi