forked from ultimatepp/ultimatepp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure_makefile
executable file
·72 lines (65 loc) · 3.3 KB
/
configure_makefile
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
#!/usr/bin/env bash
cp $1.in $1
uname=`uname`
if [[ "$uname" == 'SunOS' ]]; then
echo Configuring $1 for OpenSolaris
sed -i 's/-DflagPOSIX -DflagLINUX/-DflagPOSIX -DflagSOLARIS/' $1
sed -i 's/-Wl,--gc-sections $(LINKOPTIONS)/$(LINKOPTIONS)/' $1
sed -i 's/GCC-Gcc-Gui-Linux-Main-Posix-Shared/GCC-Gcc-Gui-Main-Posix-Shared-Solaris/' $1
sed -i 's/GCC-Gcc-Gui-Linux-Posix-Shared/GCC-Gcc-Gui-Posix-Shared-Solaris/' $1
sed -i 's/GCC-Gcc-Linux-Main-Posix-Shared/GCC-Gcc-Main-Posix-Shared-Solaris/' $1
sed -i 's/GCC-Gcc-Linux-Posix-Shared/GCC-Gcc-Posix-Shared-Solaris/' $1
sed -i 's/$(LIBPATH) -Wl,-O,2 $(LDFLAGS)/$(LIBPATH) $(LDFLAGS)/' $1
sed -i 's/-lpthread /-lposix4 /' $1
sed -i 's/-lrt /-lsocket -lnsl /' $1
fi
if [[ "$uname" == 'FreeBSD' ]]; then
echo Configuring $1 for FreeBSD
sed -i '' 's/-DflagPOSIX -DflagLINUX/-DflagPOSIX -DflagBSD -DflagFREEBSD/' $1
sed -i '' 's/-Wl,--gc-sections $(LINKOPTIONS)/$(LINKOPTIONS)/' $1
sed -i '' 's/GCC-Gcc-Gui-Linux-Main-Posix-Shared/GCC-Bsd-Freebsd-Gcc-Gui-Main-Posix-Shared/' $1
sed -i '' 's/GCC-Gcc-Gui-Linux-Posix-Shared/GCC-Bsd-Freebsd-Gcc-Gui-Posix-Shared/' $1
sed -i '' 's/GCC-Gcc-Linux-Main-Posix-Shared/GCC-Bsd-Freebsd-Gcc-Main-Posix-Shared/' $1
sed -i '' 's/GCC-Gcc-Linux-Posix-Shared/GCC-Bsd-Freebsd-Gcc-Posix-Shared/' $1
sed -i '' 's/$(LIBPATH) -Wl,-O,2 $(LDFLAGS)/$(LIBPATH) $(LDFLAGS)/' $1
sed -i '' 's/-ldl /-lexecinfo /' $1
fi
if [[ "$uname" == 'OpenBSD' ]]; then
echo Configuring $1 for OpenBSD
sed -i.bak 's/-DflagPOSIX -DflagLINUX/-DflagPOSIX -DflagBSD -DflagOPENBSD/' $1
sed -i.bak 's/-Wl,--gc-sections $(LINKOPTIONS)/$(LINKOPTIONS)/' $1
sed -i.bak 's#LIBPATH =#LIBPATH = -L"/usr/local/lib"#' $1
sed -i.bak 's#-I./ -I$(UPPOUT)#-I/usr/local/include -I./ -I$(UPPOUT)#' $1
sed -i.bak 's/GCC-Gcc-Gui-Linux-Main-Posix-Shared/GCC-Bsd-Gcc-Gui-Main-Openbsd-Posix-Shared/' $1
sed -i.bak 's/GCC-Gcc-Gui-Linux-Posix-Shared/GCC-Bsd-Gcc-Gui-Openbsd-Posix-Shared/' $1
sed -i.bak 's/GCC-Gcc-Linux-Main-Posix-Shared/GCC-Bsd-Gcc-Main-Openbsd-Posix-Shared/' $1
sed -i.bak 's/GCC-Gcc-Linux-Posix-Shared/GCC-Bsd-Gcc-Openbsd-Posix-Shared/' $1
sed -i.bak 's/$(LIBPATH) -Wl,-O,2 $(LDFLAGS)/$(LIBPATH) $(LDFLAGS)/' $1
sed -i.bak 's/-ldl /-lexecinfo /' $1
sed -i.bak 's/-lrt / /' $1
rm $1.bak
fi
if [[ "$uname" == 'NetBSD' ]]; then
echo Configuring $1 for OpenBSD
sed -i.bak 's/-DflagPOSIX -DflagLINUX/-DflagPOSIX -DflagBSD -DflagNETBSD/' $1
sed -i.bak 's/-Wl,--gc-sections $(LINKOPTIONS)/$(LINKOPTIONS)/' $1
sed -i.bak 's#LIBPATH =#LIBPATH = -L"/usr/local/lib"#' $1
sed -i.bak 's#-I./ -I$(UPPOUT)#-I/usr/local/include -I./ -I$(UPPOUT)#' $1
sed -i.bak 's/$(LIBPATH) -Wl,-O,2 $(LDFLAGS)/$(LIBPATH) $(LDFLAGS)/' $1
sed -i.bak 's/-ldl /-lexecinfo /' $1
sed -i.bak 's/-lrt / /' $1
rm $1.bak
fi
if [[ "$uname" == 'Darwin' ]]; then
echo Configuring $1 for MacOS
sed -i.bak 's/-DflagPOSIX -DflagLINUX/-DflagPOSIX -DflagBSD -DflagOSX/' $1
sed -i.bak 's/-Wl,--gc-sections $(LINKOPTIONS)/$(LINKOPTIONS)/' $1
sed -i.bak 's/\`pkg-config --cflags .*\`/ /' $1
sed -i.bak 's/\`pkg-config --libs .*\`/ /' $1
sed -i.bak 's/-lrt / -framework Foundation -framework Cocoa -framework Carbon /' $1
sed -i.bak 's/-lpng / /' $1
sed -i.bak 's/-Wl,-s/ /' $1
sed -i.bak 's/-Wl,--start-group/ /' $1
sed -i.bak 's/-Wl,--end-group/ /' $1
sed -i.bak 's/$(LIBPATH) -Wl,-O,2 $(LDFLAGS)/$(LIBPATH) $(LDFLAGS)/' $1
fi