Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
# libc-bionic
This repository contains scripts to build bionic libc (used in Android) only.
# Android Bionic Libc Standalone build

I was unable to find any documentation to build just bionic, which gave rise to this.
This repository contains scripts to build standalone **Bionic Libc** - the C Runtime Library used in Android. I was unable to find any documentation to build bionic alone, which gave rise to this.

## Prerequisites

Please install `python2`, `libc-dev-i386` and `g++-multilib` first.

Building under Linux subsystem for Windows is not supported, yet. The subsystem cannot
run 32-bit executables generated while building.
## Build

Execute the script, specifying the target configuration:

```
arch=arm ./build.sh
```

The resulting libraries with be placed into `./android_build/out/target/product/generic/obj/lib`.

## Status

Building under Linux subsystem for Windows (WSL) is not supported, yet. The subsystem cannot run 32-bit executables generated while building.

Only the latest nougat-release branch is supported as of now. I'm open to pull requests
adding support for older ones. As a consequence, the build system will use ninja, which
is mandatory post Marshmallow releases.
Only the latest Nougat release branch is supported as of now. I'm open to pull requests adding support for older ones. As a consequence, the build system will use `ninja`, which is mandatory post Marshmallow releases.
24 changes: 14 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ sources=('bionic' 'libnativehelper' 'build' 'build/kati' 'system/core' 'system/e
: ${skipndk:='no'}
# benchmarks are broken right now
: ${skipbenches:='yes'}
# zlib is not required for building
: ${skipzlib:='yes'}
: ${skipzlib:='no'}
ndkarch=$arch
gccarch=$arch
luncharch=$arch
gccver=4.9

echo "==========="
echo "libc-bionic"
echo "==========="
echo

abi="$arch-linux-android"
echo "Target ABI: $abi"

case $arch in
x86) abi='x86_64-linux-android'; ndkarch='x86_64';;
Expand All @@ -35,17 +40,16 @@ prebuilts=( "prebuilts/gcc/linux-x86/$gccarch/$abi-$gccver" "prebuilts/gcc/linux
'prebuilts/clang/host/linux-x86' 'prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8' 'prebuilts/ninja/linux-x86' 'prebuilts/misc')

download_from_git () {
echo "downloading $1"
echo "Cloning $1"

if [ -d "$topdir/$1" ]
then
rm -rf "$topdir/$1"
if [ ! -d "$topdir/$1" ]; then
mkdir -p "$topdir/$1"
cd "$topdir/$1"
git init -q
git remote add origin "$googlebaseurl/$1"
fi
mkdir -p "$topdir/$1"
cd "$topdir/$1"

git init -q
git remote add origin "$googlebaseurl/$1"
cd "$topdir/$1"
git fetch --depth 1 origin "$2" -q
git reset --hard FETCH_HEAD -q

Expand Down