-
Notifications
You must be signed in to change notification settings - Fork 207
/
nghttp3.sh
executable file
·72 lines (51 loc) · 2.06 KB
/
nghttp3.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
#!/usr/bin/env bash
# Copyright (C) Viktor Szakats. See LICENSE.md
# SPDX-License-Identifier: MIT
# shellcheck disable=SC3040,SC2039
set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail
export _NAM _VER _OUT _BAS _DST
_NAM="$(basename "$0" | cut -f 1 -d '.')"
_VER="$1"
(
cd "${_NAM}" || exit 0
rm -r -f "${_PKGDIR:?}" "${_BLDDIR:?}"
CPPFLAGS=''
if [[ "${_CONFIG}" != *'debug'* ]]; then
CPPFLAGS+=' -DNDEBUG'
fi
if [ "${_OS}" = 'win' ]; then
# Avoid deprecation warning triggered by mingw-w64 inside clang 19
CPPFLAGS+=' -D_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS'
fi
# shellcheck disable=SC2086
cmake -B "${_BLDDIR}" ${_CMAKE_GLOBAL} ${_CMAKE_CXX_GLOBAL} \
'-DENABLE_LIB_ONLY=ON' \
'-DENABLE_STATIC_LIB=ON' \
'-DENABLE_SHARED_LIB=OFF' \
'-DBUILD_TESTING=OFF' \
"-DCMAKE_C_FLAGS=${_CFLAGS_GLOBAL_CMAKE} ${_CFLAGS_GLOBAL} ${_CPPFLAGS_GLOBAL} ${CPPFLAGS} ${_LDFLAGS_GLOBAL}" \
"-DCMAKE_CXX_FLAGS=${_CFLAGS_GLOBAL_CMAKE} ${_CFLAGS_GLOBAL} ${_CPPFLAGS_GLOBAL} ${CPPFLAGS} ${_LDFLAGS_GLOBAL} ${_CXXFLAGS_GLOBAL} ${_LDFLAGS_CXX_GLOBAL}"
cmake --build "${_BLDDIR}"
cmake --install "${_BLDDIR}" --prefix "${_PP}"
# Delete .pc files
rm -r -f "${_PP}"/lib/pkgconfig
# Make steps for determinism
readonly _ref='ChangeLog'
# shellcheck disable=SC2086
"${_STRIP_LIB}" ${_STRIPFLAGS_LIB} "${_PP}"/lib/*.a
touch -c -r "${_ref}" "${_PP}"/include/nghttp3/*.h
touch -c -r "${_ref}" "${_PP}"/lib/*.a
# Create package
_OUT="${_NAM}-${_VER}${_REVSUFFIX}${_PKGSUFFIX}"
_BAS="${_NAM}-${_VER}${_PKGSUFFIX}"
_DST="$(pwd)/_pkg"; rm -r -f "${_DST}"
mkdir -p "${_DST}/include/nghttp3"
mkdir -p "${_DST}/lib"
cp -f -p "${_PP}"/include/nghttp3/*.h "${_DST}/include/nghttp3/"
cp -f -p "${_PP}"/lib/*.a "${_DST}/lib/"
cp -f -p ChangeLog "${_DST}/ChangeLog.txt"
cp -f -p AUTHORS "${_DST}/AUTHORS.txt"
cp -f -p COPYING "${_DST}/COPYING.txt"
cp -f -p README.rst "${_DST}/"
../_pkg.sh "$(pwd)/${_ref}"
)