forked from conda-forge/zstd-feedstock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
46 lines (37 loc) · 1.21 KB
/
install.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
#!/bin/bash
set -exo pipefail
export CFLAGS="${CFLAGS} -O3 -fPIC"
# Fix undefined clock_gettime
if [[ ${target_platform} =~ linux.* ]]; then
find build/cmake -type f -print0 | xargs -0 sed -i 's/THREADS_LIBS}/THREADS_LIBS} -lrt/g'
fi
make -j$CPU_COUNT -C contrib/pzstd all
declare -a _CMAKE_EXTRA_CONFIG
if [[ ${HOST} =~ .*linux.* ]]; then
# I hate you so much CMake.
LIBPTHREAD=$(find ${PREFIX} -name "libpthread.so")
_CMAKE_EXTRA_CONFIG+=(-DPTHREAD_LIBRARY=${LIBPTHREAD})
LIBRT=$(find ${PREFIX} -name "librt.so")
_CMAKE_EXTRA_CONFIG+=(-DRT_LIBRARIES=${LIBRT})
fi
if [[ "$PKG_NAME" == *static ]]; then
ZSTD_BUILD_STATIC=ON
# cannot build CLI without shared lib
ZSTD_BUILD_SHARED=ON
else
ZSTD_BUILD_STATIC=OFF
ZSTD_BUILD_SHARED=ON
fi
pushd build/cmake
FULL_AR=`which ${AR}`
cmake -GNinja \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_INSTALL_LIBDIR="lib" \
-DCMAKE_PREFIX_PATH="${PREFIX}" \
-DCMAKE_AR=${FULL_AR} \
-DZSTD_BUILD_STATIC=${ZSTD_BUILD_STATIC} \
-DZSTD_BUILD_SHARED=${ZSTD_BUILD_SHARED} \
-DZSTD_PROGRAMS_LINK_SHARED=ON \
"${_CMAKE_EXTRA_CONFIG[@]}"
ninja install
popd