-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·96 lines (80 loc) · 2.46 KB
/
configure.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
#!/bin/bash
export NAME=$(cat fpm.toml | grep -m 1 "name =" | awk -F '=' '{print $2}' | sed -E 's/[ "]//g')
export VERSION=$(tr -d '\r' < VERSION | tr -d '\n')
export LIBNAME="lib$NAME"
export PYNAME="py$NAME"
export PY_SRC="./src/$PYNAME"
export AW="auditwheel repair --plat manylinux_2_35_x86_64 ./dist/*.whl"
echo -n $VERSION > ./py/VERSION
mod=$NAME
f="./src/"$mod"_version.f90"
echo "module "$mod"__version" > $f
echo " !! Version" >> $f
echo " implicit none" >> $f
echo " private" >> $f
echo " character(len=*), parameter, public :: version = \"$VERSION\"" >> $f
echo "end module "$mod"__version" >> $f
# environment variables
export FC=gfortran
export CC=gcc
export PY=python
export PYGEN=python
export BUILD_DIR="./build"
export INCLUDE_DIR="./include"
export FPM_FFLAGS="-std=f2008 -pedantic -Wall -Wextra"
export FPM_CFLAGS="-std=c11 -pedantic -Wall -Wextra"
export FPM_LDFLAGS=""
export DEFAULT_INSTALL_DIR="$HOME/.local"
export PLATFORM="linux"
export ARCH=$(uname -m)
export EXT=".so"
# libs
# export LIBSLINUX=("libgfortran.so.5" "libquadmath.so.0")
export LIBSLINUX=""
export LIBSDARWIN=("libgfortran.5" "libquadmath.0" "libgcc_s.1.1")
export LIBSWINDOWS=("libgfortran-5" "libquadmath-0" "libgcc_s_seh-1" "libwinpthread-1")
export ROOT="/usr/lib/x86_64-linux-gnu/"
export LIBS="${LIBSLINUX[@]}"
if [[ "$OSTYPE" == "msys" ]]; then
DEFAULT_INSTALL_DIR="${APPDATA//\\//}/local"
PLATFORM="windows"
ARCH=$MSYSTEM_CARCH
ROOT=$(dirname $(where gfortran))"\\"
EXT=".dll"
LIBS=( "${LIBSWINDOWS[@]}" )
PY="py -"
PYGEN="py"
FPM_LDFLAGS="-static"
AW=""
fi
if [[ "$OSTYPE" == "darwin"* ]];then
PLATFORM="darwin"
ROOT="/usr/local/opt/gcc/lib/gcc/current/"
EXT=".dylib"
LIBS=( "${LIBSDARWIN[@]}" )
FPM_LDFLAGS="-static-libgfortran -static-libquadmath -static-libgcc"
AW=""
fi
if [[ "$VERSION" == *"dev"* ]]; then
export VERSION=$(git rev-parse --short HEAD)
fi
echo "NAME=" $NAME
echo "LIBNAME=" $LIBNAME
echo "VERSION=" $VERSION
echo "PLATFORM=" $PLATFORM
echo "ARCH=" $ARCH
echo "FPM_FFLAGS=" $FPM_FFLAGS
echo "FPM_CFLAGS=" $FPM_CFLAGS
echo "FPM_LDFLAGS=" $FPM_LDFLAGS
echo "DEFAULT INSTALL DIR=" $DEFAULT_INSTALL_DIR
echo "BUILD DIR=" $BUILD_DIR
echo "INCLUDE_DIR=" $INCLUDE_DIR
echo "PYTHON SRC=" $PY_SRC
echo "PYNAME=" $PYNAME
echo "FC=" $FC
echo "CC=" $CC
echo "PY=" $PY
echo "AW=" $AW
echo "LIBS=" ${LIBS[@]}
echo "ROOT=" $ROOT
cp -vf LICENSE ./py/LICENSE