-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.sh
executable file
·90 lines (89 loc) · 2.85 KB
/
build.sh
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
# Copyright 2024 moe-hacker
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Install dependencies.
printf "\033[1;38;2;254;228;208m"
printf "Install dependencies.\n"
printf "\033[0m"
sleep 1
pkg install ndk-multilib-native-static tsu coreutils p7zip gettext tar unzip zip git wget dpkg curl nano proot axel termux-tools util-linux pv gawk clang ndk-sysroot ndk-multilib libc-client-static libcap-static binutils libseccomp-static golang make
# Update submodule.
printf "\033[1;38;2;254;228;208m"
printf "Init submodules.\n"
printf "\033[0m"
sleep 1
git submodule update --init
# Start build.
printf "\033[1;38;2;254;228;208m"
printf "Build.\n"
printf "\033[0m"
sleep 1
# Create build dir.
mkdir build
mkdir build/DEBIAN
mkdir -p build/data/data/com.termux/files/usr/bin
mkdir -p build/data/data/com.termux/files/usr/share
mkdir -p build/data/data/com.termux/files/usr/share/daijin/proc/
mkdir -p build/data/data/com.termux/files/usr/etc
# Copy dpkg config file.
cp -r dpkg-conf/* build/DEBIAN/
chmod -R 755 build/DEBIAN
# Compile ruri.
cd src
cd ruri
./configure -s
make
cp ruri ../../build/data/data/com.termux/files/usr/bin/
# Compile rurima.
cd ../rurima
./configure -s
make
cp rurima ../../build/data/data/com.termux/files/usr/bin/
# Compile yoshinon.
cd ../yoshinon
make
cp yoshinon ../../build/data/data/com.termux/files/usr/bin/
git reset --hard
# Copy rootfstool.
cd ../rootfstool
termux-fix-shebang rootfstool
cp rootfstool ../../build/data/data/com.termux/files/usr/bin/
# Return to root dir.
cd ../..
# Copy rurima config file.
cp src/rurima.conf build/data/data/com.termux/files/usr/etc/rurima.conf
# Decompress dummy files of procfs.
tar -xf src/share/proc.tar.xz -C build/data/data/com.termux/files/usr/share/daijin/proc/
# Copy shared sh script.
cp src/share/*.sh build/data/data/com.termux/files/usr/share/daijin/
# Copy daijin main script.
cp src/daijin build/data/data/com.termux/files/usr/bin/
# Fix permission.
chmod 777 build/data/data/com.termux/files/usr/bin/*
chmod 777 build/data/data/com.termux/files/usr/share/daijin/*.sh
cd build
# Set build info.
size=$(du -s . | awk '{printf $1}')
sed -i "s/\[size\]/${size}/" DEBIAN/control
arch=$(dpkg --print-architecture)
sed -i "s/\[arch\]/${arch}/" DEBIAN/control
# Build deb.
dpkg -b . ../daijin-${arch}.deb
# Clean.
cd ..
rm -rf build
# Done.
printf "\033[1;38;2;254;228;208m"
printf "Build done, package: daijin-${arch}.deb\n"
printf "\033[0m"