forked from DISTRHO/PawPaw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
local.env
131 lines (102 loc) · 3.8 KB
/
local.env
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
#!/bin/bash
PAWPAW_ROOT="${PWD}"
SOURCING_FILES=1
target="${1}"
# ---------------------------------------------------------------------------------------------------------------------
# find path to this script
if [ -n "${BASH_SOURCE-}" ]; then
CURRENT_SCRIPT="${BASH_SOURCE}"
elif [ -n "${ZSH_VERSION-}" ]; then
CURRENT_SCRIPT="${(%):-%x}"
elif [ -n "${KSH_VERSION-}" ]; then
CURRENT_SCRIPT=${.sh.file}
else
CURRENT_SCRIPT=""
fi
if [ -n "${CURRENT_SCRIPT-}" ]; then
SCRIPT_DIR=$(dirname "${CURRENT_SCRIPT}")
else
SCRIPT_DIR="."
fi
# ---------------------------------------------------------------------------------------------------------------------
# missing target
if [ -z "${target}" ]; then
echo "usage: source local.env <target>"
# ---------------------------------------------------------------------------------------------------------------------
# contains target
elif [ -e "${SCRIPT_DIR}/setup/check_target.sh" ]; then
source "${SCRIPT_DIR}/setup/check_target.sh"
# ---------------------------------------------------------------------------------------------------------------------
# export vars if valid target
if [ "${INVALID_TARGET}" -eq 0 ]; then
source "${SCRIPT_DIR}/setup/env.sh"
export AR="${TARGET_AR}"
export CC="${TARGET_CC}"
export CXX="${TARGET_CXX}"
export LD="${TARGET_LD}"
export NM="${TARGET_NM}"
export RANLIB="${TARGET_RANLIB}"
export STRIP="${TARGET_STRIP}"
export WINDRES="${TARGET_WINDRES}"
export CFLAGS="${TARGET_CFLAGS} ${EXTRA_CFLAGS}"
export CXXFLAGS="${TARGET_CXXFLAGS} ${EXTRA_CXXFLAGS}"
export LDFLAGS="${TARGET_LDFLAGS} ${EXTRA_LDFLAGS}"
export PKG_CONFIG="${PAWPAW_PREFIX}/bin/pkg-config"
export PKG_CONFIG_PATH="${TARGET_PKG_CONFIG_PATH}"
unset CPP
unset CPPFLAGS
export OLD_PATH="${PATH}"
export PATH="${TARGET_PATH}"
alias ar="${AR}"
alias cc="${CC}"
alias gcc="${CC}"
alias g++="${CXX}"
alias ld="${ld}"
alias nm="${nm}"
alias ranlib="${ranlib}"
alias strip="${strip}"
if [ -e "${PAWPAW_PREFIX}/bin/python3${APP_EXT}" ]; then
alias python="${EXE_WRAPPER} '${PAWPAW_PREFIX}/bin/python3${APP_EXT}'"
alias python3="${EXE_WRAPPER} '${PAWPAW_PREFIX}/bin/python3${APP_EXT}'"
fi
if [ "${WASM}" -eq 1 ]; then
CMAKE="emcmake cmake"
elif [ "${CROSS_COMPILING}" -eq 1 ]; then
CMAKE_AR=$(which ${TARGET_AR})
CMAKE_RANLIB=$(which ${TARGET_RANLIB})
CMAKE="cmake \
-DCMAKE_CROSSCOMPILING=ON \
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} \
-DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR} \
-DCMAKE_AR=${CMAKE_AR} \
-DCMAKE_C_COMPILER_AR=${CMAKE_AR} \
-DCMAKE_CXX_COMPILER_AR=${CMAKE_AR} \
-DCMAKE_RANLIB=${CMAKE_RANLIB} \
-DCMAKE_C_COMPILER_RANLIB=${CMAKE_RANLIB} \
-DCMAKE_CXX_COMPILER_RANLIB=${CMAKE_RANLIB}"
if [ -n "${EXE_WRAPPER}" ]; then
CMAKE="${CMAKE} -DCMAKE_CROSSCOMPILING_EMULATOR=${EXE_WRAPPER}"
fi
else
CMAKE="cmake"
fi
if [ "${MACOS_UNIVERSAL_10_15}" -eq 1 ]; then
CMAKE="${CMAKE} -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_SYSROOT=macosx"
elif [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
CMAKE="${CMAKE} -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DCMAKE_OSX_SYSROOT=macosx"
elif [ "${MACOS}" -eq 1 ]; then
CMAKE="${CMAKE} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.8 -DCMAKE_OSX_SYSROOT=macosx"
elif [ "${WIN32}" -eq 1 ]; then
CMAKE="${CMAKE} -DCMAKE_RC_COMPILER=${WINDRES}"
fi
alias cmake="$CMAKE"
echo "Success! Environment is now ready to build stuff"
fi
# ---------------------------------------------------------------------------------------------------------------------
# end target check
else
echo "Please source this file from within the PawPaw root directory"
fi
# ---------------------------------------------------------------------------------------------------------------------
unset CURRENT_SCRIPT
unset SCRIPT_DIR