-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·150 lines (130 loc) · 4.24 KB
/
configure
File metadata and controls
executable file
·150 lines (130 loc) · 4.24 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
# 2020-core-code configuration file
#
# This file will automatically generates a makefile that runs all the sub-makefiles
#
# @author Connor Henley, @thatging3rkid
# run an apt-get update if this is automated
if test -e "config.onpush" || test -e "config.full"; then
if ! [[ -z "${CI}" ]]; then
sudo apt-get update -qq
fi
fi
# install valgrind
if ! [ -x "$(command -v valgrind)" ]; then
if ! [[ -z "${CI}" ]]; then
sudo apt-get install -y valgrind
else
printf "[*err] valgrind not installed\n"
fi
fi
# install pdflatex (only for full builds)
if ! [ -x "$(command -v pdflatex)" ] && test -e "config.full"; then
if ! [[ -z "$CI" ]]; then
# Install MiKTeX
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys D6BC243565B2087BC3F897C9277A7293F59E4889 > /dev/null
echo "deb https://mirrors.rit.edu/CTAN/systems/win32/miktex/setup/deb `lsb_release -c -s` universe" | \
sudo tee /etc/apt/sources.list.d/miktex.list > /dev/null
sudo apt-get update -qq && sudo apt-get install -y miktex
# check for error
if ! [ $? == 0 ]; then
exit 1;
fi
# Setup MiKTeX and enable auto-package installation
sudo miktexsetup --shared=yes finish && sudo initexmf --admin --set-config-value [MPM]AutoInstall=1
sudo mpm --admin --set-repository=http://mirrors.rit.edu/CTAN/systems/win32/miktex/tm/packages/
sudo mpm --admin --update-db # update database, should fix auto-package installation
else
printf "[warn] MiKTeX not installed\n"
fi
fi
# make sure lib directory exists
if ! test -d "lib"; then
mkdir lib
fi
# Start the makefile, put the header down
printf "" >Makefile
printf '# %s makefile\n' "${PWD##*/}" >>Makefile
# Print the configuration file status
if test -e "config.onpush"; then
printf '# configuration: on-push\n' >>Makefile
elif test -e "config.full"; then
printf '# configuration: full\n' >>Makefile
else
printf '# configuration: dev\n' >>Makefile
fi
# finish debugging info
printf '# Generated on: %s at %s\n' "$HOSTNAME" "`date`" >>Makefile
# Mark directories to ignore
skips=("./.git/" "./.github/" "./obj/" "./tmp/")
if ! test -e "config.full"; then
skips+=("./doc/")
fi
# Searh for Makefiles
dirs=()
for dir in ./*/
do
# check if this should be skipped
if [[ " ${skips[@]} " =~ " ${dir} " ]]; then
continue
fi
# if there's a makefile, save it
if test -f "${dir}/Makefile"; then
dirs+=(${dir})
fi
done
# Define the make mode
if test -e "config.onpush"; then
make_mode="MAKE_CONFIG=ONPUSH"
elif test -e "config.full"; then
make_mode="MAKE_CONFIG=FULL"
else
make_mode="MAKE_CONFIG=DEV"
fi
# Define the git hash
git_hash=`git describe --always`
if ! [[ $git_hash =~ [0-9a-f]{7} ]]; then
git_hash="fffffff"
fi
git_hash="GIT_HASH="${git_hash}
# define a function to generate each line of the makefile
#
# @param $1 the make command to run
# @param $2 the file/directory to generate a make entry for
gen_makefile_line(){
if test -f ${1}; then
printf '\t-make %s %s -f %s %s\n' ${make_mode} ${git_hash} ${1} ${2} >>Makefile
else
printf '\t-make %s %s -C %s %s\n' ${make_mode} ${git_hash} ${1} ${2} >>Makefile
fi
}
# Add the build-all instruction, ensuring that we clean before a build as cleaning will remove the obj dir
printf '\nall:\n' >>Makefile
for s in "${dirs[@]}"
do
gen_makefile_line ${s} "clean";
done
for s in "${dirs[@]}"
do
gen_makefile_line ${s} "ci-build";
done
printf '\t@echo "Finished running ci-build for all"\n' >>Makefile
# Add the test instruction
printf '\ncheck:\n' >>Makefile
for s in "${dirs[@]}"
do
gen_makefile_line ${s} "ci-test";
done
printf '\t@echo "Finished running ci-test for all"\n' >>Makefile
# Add the clean instruction
printf '\nclean:\n' >>Makefile
# We need to clean everything before we make anything, or the clean instructions will wipe all the previous obj files
for s in "${dirs[@]}"
do
gen_makefile_line ${s} "clean";
done
printf '\t@echo "Finished running clean for all"\n' >>Makefile
# Supply the required recipes (just in case another makefile is above this one)
printf '\n# Required recipes\nci-build: all\nci-test: check\n' >>Makefile
echo "Complete!"