Repository navigation
Expand file tree
/
Copy pathmake-source-tarball.sh
More file actions
executable file
·53 lines (45 loc) · 1.69 KB
/
Copy pathmake-source-tarball.sh
File metadata and controls
executable file
·53 lines (45 loc) · 1.69 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
#!/usr/bin/env bash
# Creates arrayfire-full-<version>.tar.bz2 next to the source directory: the
# sources plus every dependency that CMake would otherwise download, so the
# tarball builds without network access.
#
# Usage: make-source-tarball.sh <source directory> <version>
# The source directory is renamed to arrayfire-full-<version> if needed. It is
# modified in place, so pass a throwaway checkout.
set -euo pipefail
source_dir=$1
version=$2
forge_version=1.0.8
name=arrayfire-full-$version
sudo=
[[ $(id -u) -eq 0 ]] || sudo=sudo
export DEBIAN_FRONTEND=noninteractive
# Configuring with the CUDA and OpenCL toolkits present makes CMake fetch the
# sources of every backend's dependencies.
$sudo apt-get update -q
$sudo apt-get install -y -q --no-install-recommends \
build-essential bzip2 ca-certificates cmake curl git libboost-dev \
libfftw3-dev libfontconfig1-dev libglfw3-dev liblapacke-dev libopenblas-dev \
nvidia-cuda-toolkit ocl-icd-opencl-dev
parent=$(cd "$(dirname "$source_dir")" && pwd)
if [[ $(basename "$source_dir") != "$name" ]]; then
mv "$source_dir" "$parent/$name"
fi
cd "$parent/$name"
cmake -S . -B build -DAF_BUILD_FORGE=ON -DAF_COMPUTE_LIBRARY=FFTW/LAPACK/BLAS \
-DAF_TEST_WITH_MTX_FILES=OFF
rm -rf .git .github .gitmodules
cd build/extern
rm -rf ./*-build ./*-subbuild matrixmarket
for dep in */; do
rm -rf "$dep.git" "$dep.gitattributes" "$dep.gitmodules"
done
cp -r ./* ../../extern/
cd ../..
curl -fsSL "https://github.com/arrayfire/forge/releases/download/v$forge_version/forge-full-$forge_version.tar.bz2" \
| tar -xj
mv "forge-full-$forge_version" extern/af_forge-src
rm -rf build
cd "$parent"
tar -cjf "$name.tar.bz2" "$name"
echo "Created $parent/$name.tar.bz2"