-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure
executable file
·65 lines (54 loc) · 1.91 KB
/
configure
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
#!/bin/sh
set -eu
cygwin_root="$(cygpath -m /)"
cygwin_arch="$(uname -m)"
mingw_arch="$(ocamlc -config 2>/dev/null | awk '/^system/ {print $2}')"
if [ "$mingw_arch" != "mingw64" ] && [ "$mingw_arch" != "mingw" ] ; then
echo "unsupported mingw_arch: '$mingw_arch'" >&2
exit 2
fi
case "$cygwin_arch" in
*[Ii][3456789]86*)
url='https://www.cygwin.com/setup-x86.exe' ;;
*[Xx]86_64*)
url='https://www.cygwin.com/setup-x86_64.exe' ;;
*)
echo "unsupported platform $cygwin_arch" >&2
exit 1
esac
if [ ! -f "cygwin-dl.exe" ]; then
if which curl >/dev/null 2>&1 ; then
curl --retry 2 --retry-delay 3 -L -o cygwin-dl.exe "$url"
elif which wget >/dev/null 2>&1 ; then
wget --content-disposition -t 3 -O cygwin-dl.exe "$url"
else
echo "wget / curl not installed" >&2
exit 1
fi
chmod 0755 cygwin-dl.exe
fi
if [ "$mingw_arch" = "mingw64" ]; then
help="$(cygpath -m /usr/bin/x86_64-w64-mingw32-pkg-config.exe | sed 's|/|\\\\\\\\|g')"
else
help="$(cygpath -m /usr/bin/i686-w64-mingw32-pkg-config.exe | sed 's|/|\\\\\\\\|g')"
fi
help2="$(cygpath -m /usr/bin/pkgconf.exe | sed 's|/|\\\\\\\\|g' || echo "")"
sed "s|@PKG_CONFIG@|$help|g" config.h.in | sed "s|@PKGCONF@|$help2|g" >config.h
sed \
-e "s|@CYGWIN_ROOT@|${cygwin_root}|g" \
-e "s|@CYGWIN_ARCH@|${cygwin_arch}|g" \
-e "s|@MINGW_ARCH@|${mingw_arch}|g" \
depext-cygwin.conf.in > depext-cygwin.conf
if [ "$mingw_arch" = "mingw64" ]; then
toolkit_prefix='x86_64-w64-mingw32-'
else
toolkit_prefix='i686-w64-mingw32-'
fi
bin_path="$(cygpath -m /bin | sed 's|/|\\\\\\\\|g')"
for prog in addr2line ar as cc cpp dlltool dllwrap g++ gcc gcov ld nm objcopy objdump ranlib strings strip windres ; do
/bin/sed \
-e "s|@TOOLKIT_PREFIX@|${toolkit_prefix}|g" \
-e "s|@PROG@|${prog}|g" \
-e "s|@BIN_PATH@|${bin_path}|g" \
symlink2.c > "${prog}.c"
done