blob: 7e6631efc973b8797de00ec19fce76718ff2bd66 [file] [log] [blame]
Stephen Hinesbe965652013-12-20 16:46:25 -08001#!/bin/bash
2
3# We are currently in frameworks/rs, so compute our top-level directory.
4MY_ANDROID_DIR=$PWD/../../
5cd $MY_ANDROID_DIR
6
7# ANDROID_HOST_OUT is where the new prebuilts will be constructed/copied from.
8ANDROID_HOST_OUT=$MY_ANDROID_DIR/out/host/linux-x86/
9
10# HOST_LIB_DIR allows us to pick up the built librsrt_*.bc libraries.
11HOST_LIB_DIR=$ANDROID_HOST_OUT/lib
12
13# PREBUILTS_DIR is where we want to copy our new files to.
14PREBUILTS_DIR=$MY_ANDROID_DIR/prebuilts/sdk/
15
16# Target architectures and their system library names.
17TARGETS=(arm mips x86)
18SYS_NAMES=(generic generic_mips generic_x86)
19
20print_usage() {
21 echo "USAGE: $0 [-h|--help] [-n|--no-build] [-x]"
22 echo "OPTIONS:"
23 echo " -h, --help : Display this help message."
24 echo " -n, --no-build : Skip the build step and just copy files."
25 echo " -x : Display commands before they are executed."
26}
27
28build_rs_libs() {
29 echo Building for target $1
30 lunch $1
31 # Build the RS runtime libraries.
32 cd $MY_ANDROID_DIR/frameworks/rs/driver/runtime && mma -j32 && cd - || exit 1
33 # Build a sample support application to ensure that all the pieces are up to date.
34 cd $MY_ANDROID_DIR/frameworks/rs/java/tests/RSTest_CompatLib/ && mma -j32 && cd - || exit 2
35}
36
37# Build everything by default
38build_rs=1
39
40while [ $# -gt 0 ]; do
41 case "$1" in
42 -h|--help)
43 print_usage
44 exit 0
45 ;;
46 -n|--no-build)
47 build_rs=0
48 ;;
49 -x)
50 # set lets us enable bash -x mode.
51 set -x
52 ;;
53 *)
54 echo Unknown argument: "$1"
55 print_usage
56 exit 99
57 break
58 ;;
59 esac
60 shift
61done
62
63if [ $build_rs -eq 1 ]; then
64
65 echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
66 echo !!! BUILDING RS PREBUILTS !!!
67 echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
68
69 source build/envsetup.sh
70
71 for t in ${TARGETS[@]}; do
72 build_rs_libs aosp_${t}-userdebug
73 done
74
75 echo DONE BUILDING RS PREBUILTS
76
77else
78
79 echo SKIPPING BUILD OF RS PREBUILTS
80
81fi
82
83DATE=`date +%Y%m%d`
84
85cd $PREBUILTS_DIR || exit 3
86repo start pb_$DATE .
87
88for i in $(seq 0 $((${#TARGETS[@]} - 1))); do
89 t=${TARGETS[$i]}
90 sys_lib_dir=$MY_ANDROID_DIR/out/target/product/${SYS_NAMES[$i]}/system/lib
91 for a in `find renderscript/lib/$t -name \*.so`; do
92 file=`basename $a`
93 cp `find $sys_lib_dir -name $file` $a || exit 4
94 done
95
96 for a in `find renderscript/lib/$t -name \*.bc`; do
97 file=`basename $a`
98 cp `find $HOST_LIB_DIR $sys_lib_dir -name $file` $a || exit 5
99 done
100done
101
102# general
103# javalib.jar
104cp $MY_ANDROID_DIR/out/target/common/obj/JAVA_LIBRARIES/android-support-v8-renderscript_intermediates/javalib.jar renderscript/lib
105
106# Copy header files for compilers
107cp $MY_ANDROID_DIR/external/clang/lib/Headers/*.h renderscript/clang-include
108cp $MY_ANDROID_DIR/frameworks/rs/scriptc/* renderscript/include
109
110
111# Linux-specific tools (bin/ and lib/)
112TOOLS_BIN="
113bcc_compat
114llvm-rs-cc
115"
116
117TOOLS_LIB="
118libbcc.so
119libbcinfo.so
120libclang.so
121libLLVM.so
122"
123
124for a in $TOOLS_BIN; do
125 cp $ANDROID_HOST_OUT/bin/$a tools/linux/
126 strip tools/linux/$a
127done
128
129for a in $TOOLS_LIB; do
130 cp $ANDROID_HOST_OUT/lib/$a tools/linux/
131 strip tools/linux/$a
132done
133
134echo "DON'T FORGET TO UPDATE THE DARWIN COMPILER PREBUILTS!!!"