Initial commit
This commit is contained in:
commit
05d5912150
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*.swp
|
||||
source/
|
||||
out/
|
74
Dockerfile
Normal file
74
Dockerfile
Normal file
@ -0,0 +1,74 @@
|
||||
FROM debian:stretch
|
||||
|
||||
RUN cat /etc/apt/sources.list | sed "s/deb /deb-src /g" >> /etc/apt/sources.list \
|
||||
&& sed -i "s/ main/ main contrib/g" /etc/apt/sources.list \
|
||||
&& dpkg --add-architecture i386 \
|
||||
&& apt-get update \
|
||||
&& apt-get build-dep -y \
|
||||
gcc \
|
||||
binutils \
|
||||
llvm-defaults \
|
||||
&& apt-get install -y \
|
||||
kmod \
|
||||
sudo \
|
||||
git \
|
||||
repo \
|
||||
gcc-arm-none-eabi \
|
||||
cmake \
|
||||
python-dev \
|
||||
swig \
|
||||
ant \
|
||||
bc \
|
||||
proguard \
|
||||
maven-debian-helper \
|
||||
libemma-java \
|
||||
libasm4-java \
|
||||
libguava-java \
|
||||
libnb-platform18-java \
|
||||
libnb-org-openide-util-java \
|
||||
libandroidsdk-ddmlib-java \
|
||||
libmaven-source-plugin-java \
|
||||
libfreemarker-java \
|
||||
libmaven-javadoc-plugin-java \
|
||||
ca-cacert \
|
||||
curl \
|
||||
gawk \
|
||||
libgmp3-dev \
|
||||
libmpfr-dev \
|
||||
libmpc-dev \
|
||||
git-core \
|
||||
gperf \
|
||||
libncurses-dev \
|
||||
squashfs-tools \
|
||||
pngcrush \
|
||||
zip \
|
||||
zlib1g-dev \
|
||||
lzma \
|
||||
libc6-dev-i386 \
|
||||
g++-multilib \
|
||||
lib32z1-dev \
|
||||
lib32readline-dev \
|
||||
lib32ncurses5-dev \
|
||||
zlib1g-dev:i386 \
|
||||
xsltproc \
|
||||
python-mako \
|
||||
schedtool \
|
||||
gradle \
|
||||
dirmngr \
|
||||
libandroidsdk-sdklib-java \
|
||||
eclipse-jdt \
|
||||
libgradle-android-plugin-java \
|
||||
android-sdk-build-tools \
|
||||
android-sdk-platform-23 \
|
||||
aapt \
|
||||
lzop \
|
||||
&& mkdir /build \
|
||||
&& git config --global user.email "replicant@localhost" \
|
||||
&& git config --global user.name "replicant"
|
||||
|
||||
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
ENV USER root
|
||||
VOLUME /build
|
||||
WORKDIR /build
|
||||
ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ]
|
5
README.md
Normal file
5
README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Replicant BuildStage
|
||||
|
||||
adhoczone/replicant-buildstage
|
||||
|
||||
*WIP*
|
3
build-image.sh
Executable file
3
build-image.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker build --tag adhoczone/replicant-buildstage .
|
115
entrypoint.sh
Executable file
115
entrypoint.sh
Executable file
@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
build_directory="/build"
|
||||
|
||||
function initializeSourceTree() {
|
||||
manifest="$1"
|
||||
branch="$2"
|
||||
repo init -u "$manifest" -b "$branch"
|
||||
}
|
||||
|
||||
function repoSync() {
|
||||
repo sync
|
||||
}
|
||||
|
||||
function getPrebuilts() {
|
||||
cd "$build_directory"
|
||||
gpg \
|
||||
--keyserver pool.sks-keyservers.net \
|
||||
--recv-key 7A029E54DD5DCE7A
|
||||
./vendor/replicant/get-prebuilts
|
||||
}
|
||||
|
||||
function buildToolchain() {
|
||||
cd "$build_directory"
|
||||
./vendor/replicant/build-toolchain
|
||||
}
|
||||
|
||||
function loadBuildVars() {
|
||||
source "$build_directory"/build/envsetup.sh
|
||||
}
|
||||
|
||||
function lunchDevice() {
|
||||
device="$1"
|
||||
mode="$2"
|
||||
lunch replicant_"$device"-"${mode:-userdebug}"
|
||||
}
|
||||
|
||||
function buildPackage() {
|
||||
device="$1"
|
||||
mode="$2"
|
||||
loadBuildVars
|
||||
lunchDevice "$device" "$mode"
|
||||
getPrebuilts
|
||||
cd "$build_directory"
|
||||
make -j ${threads:-4} bacon
|
||||
}
|
||||
|
||||
function partialBuildPackage() {
|
||||
device="$2"
|
||||
sub_project="$3"
|
||||
cd "$build_directory"/"$sub_project"
|
||||
mm -B
|
||||
make -j ${threads:-4} snod
|
||||
}
|
||||
|
||||
function cleanBuild() {
|
||||
cd "$build_directory"
|
||||
loadBuildVars
|
||||
make clean
|
||||
}
|
||||
|
||||
cd "$build_directory"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo -e "No parameter specified."
|
||||
exit 1
|
||||
else
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
|
||||
-j | --threads )
|
||||
threads="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
-i | --initialize )
|
||||
manifest="$2"
|
||||
branch="$3"
|
||||
initializeSourceTree "$manifest" "$branch"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
|
||||
-p | --pull )
|
||||
repoSync
|
||||
;;
|
||||
|
||||
-t | --build-toolchain )
|
||||
buildToolchain
|
||||
;;
|
||||
|
||||
-b | --build )
|
||||
device="$2"
|
||||
buildPackage "$device"
|
||||
shift
|
||||
;;
|
||||
|
||||
-B | --partial )
|
||||
device="$2"
|
||||
sub_project="$3"
|
||||
partialBuildPackage "$device" "$sub_project"
|
||||
shift
|
||||
;;
|
||||
|
||||
-c | --clean )
|
||||
cleanBuild
|
||||
;;
|
||||
|
||||
esac
|
||||
shift
|
||||
done
|
||||
fi
|
||||
|
21
replicant-buildstage.sh
Executable file
21
replicant-buildstage.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker_image="adhoczone/replicant-buildstage"
|
||||
source_directory="$PWD/source"
|
||||
output_directory="$PWD/out"
|
||||
|
||||
if [[ "$1" == "attach" ]]; then
|
||||
exec docker run --rm -it \
|
||||
-v "$source_directory:/build" \
|
||||
-v "$output_directory:/build/out" \
|
||||
--entrypoint "/bin/bash" \
|
||||
"$docker_image"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec docker run --rm -it \
|
||||
-v "$source_directory:/build" \
|
||||
-v "$output_directory:/build/out" \
|
||||
"$docker_image" \
|
||||
"$@"
|
||||
|
Loading…
Reference in New Issue
Block a user