forked from lunar-linux/lunar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptimize.lunar
73 lines (63 loc) · 2.31 KB
/
optimize.lunar
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
#!/bin/bash
############################################################
# #
# optimize.lunar - Lunar general optimization code #
# #
############################################################
# #
# Copyright 2006 by Auke Kok under GPLv2 #
# #
############################################################
bad_flags()
{
debug_msg "bad_flags ($@)"
verbose_msg "bad_flags \"$@\""
# maintain some degree of backward compatibility here
if [[ "$1" == "ALL" ]]; then
unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
elif [[ "$1" == "compiler" ]]; then
unset CFLAGS CXXFLAGS CPPFLAGS
elif [[ "$1" == "linker" ]]; then
unset LDFLAGS
else
for BAD_FLAG in "$@" ; do
CFLAGS="${CFLAGS//$BAD_FLAG/}"
CXXFLAGS="${CXXFLAGS//$BAD_FLAG/}"
CPPFLAGS="${CPPFLAGS//$BAD_FLAG/}"
LDFLAGS="${LDFLAGS//$BAD_FLAG/}"
done
fi
verbose_msg "CFLAGS=\"$CFLAGS\""
verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
verbose_msg "CPPFLAGS=\"$CPPFLAGS\""
verbose_msg "LDFLAGS=\"$LDFLAGS\""
}
optimize_menu()
{(
export IFS=$'\t\n'
while true; do
if [ -z "$(plugin_call OPTIMIZE_MENU)" ]; then
$DIALOG --msgbox "There are no configurable compontents. Please update your moonbase!" 6 60
return
fi
PLUGIN=`$DIALOG --cancel-label "Close" --default-item "$PLUGIN" --menu "Select a component for which to configure optimizations" 0 0 0 $(plugin_call OPTIMIZE_MENU)`
if [ $? != 0 ]; then
return
fi
plugin_call OPTIMIZE_MENU $PLUGIN
done
)}
# because we pretty much need to know our $BUILD string
# everywhere this code is separate and guides all other
# parts of lunar where related things are done. Here we
# autodetect the most important part but leave it open
# to the user to override it
# PLATFORM - translated uname -m / arch
PLATFORM=$(uname -m | sed 's/i[3456]86/x86/')
# BUILD -
case $PLATFORM in
x86|x86_64)
BUILD=$(uname -m)-pc-linux-gnu ;;
*)
BUILD=$(uname -m | sed 's/.*/\L&/g')-linux-gnu ;;
esac