-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgenerate_build_config.sh
executable file
·51 lines (44 loc) · 1.39 KB
/
generate_build_config.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
#!/bin/bash
if command -v mapnik-config &> /dev/null
then
# Configuration for mapnik 3
CGO_CFLAGS=$(mapnik-config --includes)
CGO_CXXFLAGS=$(mapnik-config --includes)
CGO_LDFLAGS=$(mapnik-config --libs)
FONT_DIR=$(mapnik-config --fonts)
PLUGINS_DIR=$(mapnik-config --input-plugins)
else
# Configuration for mapnik >=4
if command -v brew &> /dev/null
then
export PKG_CONFIG_PATH=$(brew --prefix icu4c)/lib/pkgconfig
fi
CGO_CFLAGS=$(pkg-config libmapnik --cflags)
CGO_CXXFLAGS="$(pkg-config libmapnik --cflags) --std=c++17"
CGO_LDFLAGS=$(pkg-config libmapnik --libs)
FONT_DIR=$(pkg-config libmapnik --variable=fonts_dir)
PLUGINS_DIR=$(pkg-config libmapnik --variable=plugins_dir)
if command -v brew &> /dev/null
then
CGO_CFLAGS="$CGO_CFLAGS -I$(brew --prefix boost)/include"
CGO_CXXFLAGS="$CGO_CXXFLAGS -I$(brew --prefix boost)/include"
fi
if [[ -d /opt/homebrew/include ]]
then
CGO_CFLAGS="$CGO_CFLAGS -I/opt/homebrew/include"
CGO_CXXFLAGS="$CGO_CXXFLAGS -I/opt/homebrew/include"
fi
fi
# Write CGO flags and Mapnik font/plugin path to build_config.go
cat <<EOF > build_config.go
// Code generated by generate_build_config.sh; DO NOT EDIT.
package mapnik
// #cgo CFLAGS: ${CGO_CFLAGS}
// #cgo CXXFLAGS: ${CGO_CXXFLAGS}
// #cgo LDFLAGS: ${CGO_LDFLAGS}
import "C"
var (
fontPath = "${FONT_DIR}"
pluginPath = "${PLUGINS_DIR}"
)
EOF