-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_flags.stub
49 lines (44 loc) · 1.33 KB
/
compile_flags.stub
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
#!/bin/sh
# generate compile_flags.txt for clangd by running this as
#
# NGX_HOME=/path/to/nginx_sources \
# NGX_HASKELL_MODULE_HOME=/path/to/nginx_haskell_module_sources \
# . compile_flags.stub > compile_flags.txt
#
ghc_pkg_program=ghc-pkg
if test -n "$GHC_PKG_PROGRAM"
then
ghc_pkg_program="$GHC_PKG_PROGRAM"
fi
if ! command -v "$ghc_pkg_program" >/dev/null 2>&1
then
echo "error: unable to find ghc-pkg program!" >&2
echo " Check that GHC is installed "`
`"or specify environment variable GHC_PKG_PROGRAM" >&2
else
while :
do
if test -z "$NGX_HOME"
then
echo "error: environment variable NGX_HOME is not set!" >&2
break
fi
if test -z "$NGX_HASKELL_MODULE_HOME"
then
echo "error: environment variable NGX_HASKELL_MODULE_HOME "`
`"is not set!" >&2
break
fi
echo -I"$NGX_HOME/src/core"
echo -I"$NGX_HOME/src/http"
echo -I"$NGX_HOME/src/http/modules"
echo -I"$NGX_HOME/src/event"
echo -I"$NGX_HOME/src/event/modules"
echo -I"$NGX_HOME/src/os/unix"
echo -I"$NGX_HOME/objs"
echo -I"$NGX_HASKELL_MODULE_HOME/src"
echo -I"$($ghc_pkg_program field rts include-dirs --simple-output)" |
sed 's/,/ -I/g'
break
done
fi