blob: ae727b8b3122949fee8d51de8a157f6e1912d3f2 (
plain)
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
|
#!/bin/sh
# This script contains common helpers for all ports.
set -e
if [ -z "$MAKEOPTS" ]; then
MAKEOPTS="-j $(nproc)"
fi
if [ -z "$INSTALLOPTS" ]; then
INSTALLOPTS=""
fi
if [ -z "$SERENITY_ROOT" ]; then
echo "You must have source'd UseIt.sh to build any ports!"
exit 1
fi
if [ -z "$PORT_DIR" ]; then
echo "Must set PORT_DIR to where the source should be cloned."
exit 1
fi
run_command() {
echo "+ $@"
(cd "$PORT_DIR" && "$@")
echo "+ FINISHED: $@"
}
run_command_nocd() {
echo "+ $@ (nocd)"
("$@")
echo "+ FINISHED (nocd): $@"
}
run_fetch_git() {
if [ -d "$PORT_DIR/.git" ]; then
run_command git fetch
run_command git reset --hard FETCH_HEAD
run_command git clean -fx
else
run_command_nocd git clone "$1" "$PORT_DIR"
fi
}
run_fetch_web() {
if [ -d "$PORT_DIR" ]; then
run_command_nocd rm -rf "$PORT_DIR"
fi
file=$(basename "$1")
run_command_nocd curl -L "$1" -o "$file"
mkdir "$PORT_DIR"
# may need to make strip-components configurable, as I bet some sick person
# out there has an archive that isn't in a directory :shrug:
run_command_nocd tar xavf "$file" -C "$PORT_DIR" --strip-components=1
}
run_export_env() {
export $1="$2"
}
run_replace_in_file() {
run_command perl -p -i -e "$1" $2
}
run_patch() {
echo "+ Applying patch $1"
run_command patch "$2" < "$1"
}
run_configure_cmake() {
run_command cmake -DCMAKE_TOOLCHAIN_FILE="$SERENITY_ROOT/Toolchain/CMakeToolchain.txt" $CMAKEOPTS .
}
run_configure_autotools() {
run_command ./configure --host=i686-pc-serenity "$@"
}
run_make() {
run_command make $MAKEOPTS "$@"
}
run_make_install() {
run_command make $INSTALLOPTS install "$@"
}
run_send_to_file() {
echo "+ rewrite '$1'"
(cd "$PORT_DIR" && echo "$2" > "$1")
echo "+ FINISHED"
}
if [ -z "$1" ]; then
echo "+ Fetching..."
fetch
echo "+ Configuring..."
configure
echo "+ Building..."
build
echo "+ Installing..."
install
exit 0
fi
if [ "$1" = "fetch" ]; then
echo "+ Fetching..."
fetch
elif [ "$1" = "configure" ]; then
echo "+ Configuring..."
configure
elif [ "$1" = "build" ]; then
echo "+ Building..."
build
elif [ "$1" = "install" ]; then
echo "+ Installing..."
install
else
echo "Unknown verb: $1"
echo "Supported: (one of) fetch configure build install"
exit 1
fi
|