-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompile
More file actions
executable file
·86 lines (86 loc) · 3.12 KB
/
Copy pathcompile
File metadata and controls
executable file
·86 lines (86 loc) · 3.12 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/sh
#
# Setup some global variables...
#
exec="bolts"
source="bolts.c"
cc="gcc"
#
# Note: Note. Some systems, i.e. Redhat and some BSD systems require you
# include the Crypt Library on the compiler command line using the
# -lcrypt command. You can also define other compiler options like
# -O3 for optimization, and/or -m486 etc. See the manual pages for
# your compiler! Use -DGLIBC207 if you have a GLIBC 2.0.7 or higher!
#
ccops="-lcrypt -O3"
#ccops="-O3 -m486"
#ccops="-DGLIBC207"
#ccops="-lcrypt -DGLIBC207"
#ccops=""
#
# Get Host Compilation Information To Be Imported Into Moenuts.
# For example, What machine type etc.
#
fullinfo=`uname -a`
if [ "$fullinfo" = "" ]; then fullinfo="Unknown"; fi
host=$HOSTNAME
if [ "$host" = "" ]; then host=`hostname`; fi
if [ "$host" = "" ]; then host=`uname -n`; fi
if [ "$host" = "" ]; then host=$HOST; fi
if [ "$host" = "" ]; then host="unknown"; fi
user=$USER
if [ "$user" = "" ]; then user=$LOGNAME; fi
if [ "$user" = "" ]; then user=`logname`; fi
if [ "$user" = "" ]; then user="unknown"; fi
system=`uname -s`
if [ "$machine" = "" ]; then machine=$MACHINE; fi
if [ "$machine" = "" ]; then machine="unknown"; fi
release=`uname -r`
if [ "$release" = "" ]; then release="unknown"; fi
machine=`uname -m`
if [ "$machine" = "" ]; then machine=$MACHINE; fi
if [ "$machine" = "" ]; then machine=$HOSTTYPE; fi
if [ "$machine" = "" ]; then machine=$hosttype; fi
if [ "$machine" = "" ]; then machine="unknown"; fi
timezone=$TZ
if [ "$timezone" = "" ]; then timezone="EST5EDT"; fi
#
# Remove Old hostinfo.h if it exists because we're gonna make a fresh one!
#
rm -f ./hostinfo.h
#
echo "/* Bolts System Compilation Information */" > hostinfo.h
echo "" >> hostinfo.h
echo "#define COMPILE_BY \"$user\"" >> hostinfo.h
echo "#define COMPILE_HOST \"$host\"" >> hostinfo.h
echo "#define COMPILE_OSNAME \"$system\"" >> hostinfo.h
echo "#define COMPILE_HOSTTYPE \"$machine\"" >> hostinfo.h
echo "#define COMPILE_RELEASE \"$release\"" >> hostinfo.h
echo "#define COMPILE_DATE \"`date +%D`\"" >> hostinfo.h
echo "#define COMPILE_TIME \"`date +%T`\"" >> hostinfo.h
echo "#define COMPILE_FULL \"$fullinfo\"" >> hostinfo.h
echo "" >> hostinfo.h
clear
echo "Current Host Information..."
echo ""
echo "Account Name : $user ($user@$host)"
echo "Host Info : $machine $system $release ($host)"
echo "Date & Time : `date +%D` at `date +%T`"
echo "Timezone : $timezone"
echo ""
#
# Remove Old Executable If It Exists Incase Compile Fails, We'll Have A Recent
# Backup Of The Executable. Just Named <exec>.old
#
echo "Making Backup Copy Of Old Executable, Saving It As $exec.old..."
rm -f ./$exec.old
mv ./$exec ./$exec.old
echo "Making Backup Copy Of Old System Log, Saving It As syslog.bak..."
mv ./syslog ./syslog.bak
echo "Building $talkername: Compiling $source -=> $exec..."
echo ""
echo $cc $source $ccops -o $exec $2 $3 $4 $5
$cc $source $ccops -o $exec $2 $3 $4 $5 || echo "Removing Extra Debugging Information And Running $exec..." ; echo "" ; strip ./$exec ; echo Executing $exec ; ./$exec
echo ""
echo "Please read the README file if you haven't already before you go any further!"
echo ""