Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame^] | 3 | # This script takes a Linux SDK, cleans it and injects the necessary Windows |
| 4 | # binaries needed by the SDK. The script has 2 parts: |
| 5 | # - development/tools/build/path_windows_sdk.sh to process the |
| 6 | # platform-dependent folders and files. |
| 7 | # - sdk/build/patch_windows_sdk.sh to process folder and files which |
| 8 | # depend on the sdk.git repo. This file will be invoked by this one. |
| 9 | # |
| 10 | # Input arguments: |
| 11 | # -q = Optional arg to make this silent. Must be given first. |
| 12 | # $1 = Temporary SDK directory, that is the Linux SDK being patched into |
| 13 | # a Windows one. |
| 14 | # $2 = The out/host/windows directory, which contains the new Windows |
| 15 | # binaries to use. |
| 16 | # $3 = An optional replacement for $TOPDIR (inherited from the Android |
| 17 | # build system), which is the top directory where Android is located. |
| 18 | |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 19 | # Verbose by default. Use -q to make more silent. |
| 20 | V="-v" |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame^] | 21 | Q="" |
| 22 | if [[ "$1" == "-q" ]]; then |
| 23 | Q="$1" |
| 24 | V="" |
| 25 | shift |
| 26 | fi |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 27 | |
| 28 | TEMP_SDK_DIR=$1 |
| 29 | WIN_OUT_DIR=$2 |
| 30 | TOPDIR=${TOPDIR:-$3} |
| 31 | |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame^] | 32 | # The unix2dos is provided by the APT package "tofrodos". However |
| 33 | # as for ubuntu lucid, the package renamed the command to "todos". |
| 34 | UNIX2DOS=`which unix2dos` |
| 35 | if [[ ! -x $UNIX2DOS ]]; then |
| 36 | UNIX2DOS=`which todos` |
| 37 | fi |
| 38 | |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 39 | PLATFORMS=( $TEMP_SDK_DIR/platforms/* ) |
| 40 | if [[ ${#PLATFORMS[@]} != 1 ]]; then |
| 41 | echo "Error: Too many platforms found in $TEMP_SDK_DIR" |
| 42 | echo "Only one was expected." |
| 43 | echo "Instead, found: ${PLATFORMS[@]}" |
| 44 | exit 1 |
| 45 | fi |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 46 | |
| 47 | # Package USB Driver |
| 48 | if [[ -n "$USB_DRIVER_HOOK" ]]; then |
| 49 | $USB_DRIVER_HOOK $V $TEMP_SDK_DIR $TOPDIR |
| 50 | fi |
| 51 | |
| 52 | # Remove obsolete stuff from tools & platform |
| 53 | TOOLS=$TEMP_SDK_DIR/tools |
Raphael Moll | ff779c0 | 2010-08-05 13:30:39 -0700 | [diff] [blame] | 54 | PLATFORM_TOOLS=$TEMP_SDK_DIR/platform-tools |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 55 | LIB=$TEMP_SDK_DIR/tools/lib |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame^] | 56 | rm $V $TOOLS/{dmtracedump,etc1tool,hprof-conv,sqlite3,zipalign} |
Raphael Moll | b04a4f9 | 2010-10-23 22:11:37 -0700 | [diff] [blame] | 57 | rm $V $TOOLS/proguard/bin/*.sh |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 58 | rm $V $LIB/*/swt.jar |
Raphael Moll | 2f61396 | 2010-09-27 16:20:07 -0700 | [diff] [blame] | 59 | rm $V $PLATFORM_TOOLS/{adb,aapt,aidl,dx,dexdump} |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 60 | |
| 61 | # Copy all the new stuff in tools |
| 62 | # Note: some tools are first copied here and then moved in platforms/<name>/tools/ |
| 63 | cp $V $WIN_OUT_DIR/host/windows-x86/bin/*.{exe,dll} $TOOLS/ |
| 64 | mkdir -pv $LIB/x86 |
| 65 | cp $V ${TOPDIR}prebuilt/windows/swt/swt.jar $LIB/x86/ |
| 66 | mkdir -pv $LIB/x86_64 |
| 67 | cp $V ${TOPDIR}prebuilt/windows-x86_64/swt/swt.jar $LIB/x86_64/ |
| 68 | |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 69 | # Put the JetCreator tools, content and docs (not available in the linux SDK) |
| 70 | JET=$TOOLS/Jet |
| 71 | JETCREATOR=$JET/JetCreator |
| 72 | JETDEMOCONTENT=$JET/demo_content |
| 73 | JETLOGICTEMPLATES=$JET/logic_templates |
| 74 | JETDOC=$TEMP_SDK_DIR/docs/JetCreator |
| 75 | |
| 76 | # need to rm these folders since a Mac SDK will have them and it might create a conflict |
| 77 | rm -rf $V $JET |
| 78 | rm -rf $V $JETDOC |
| 79 | |
| 80 | # now create fresh folders for JetCreator |
| 81 | mkdir $V $JET |
| 82 | mkdir $V $JETDOC |
| 83 | |
| 84 | cp -r $V ${TOPDIR}external/sonivox/jet_tools/JetCreator $JETCREATOR/ |
| 85 | cp -r $V ${TOPDIR}external/sonivox/jet_tools/JetCreator_content $JETDEMOCONTENT/ |
| 86 | cp -r $V ${TOPDIR}external/sonivox/jet_tools/logic_templates $JETLOGICTEMPLATES/ |
| 87 | chmod $V -R u+w $JETCREATOR # fixes an issue where Cygwin might copy the above as u+rx only |
Raphael Moll | 2f61396 | 2010-09-27 16:20:07 -0700 | [diff] [blame] | 88 | cp $V ${TOPDIR}prebuilt/windows/jetcreator/EASDLL.dll $JETCREATOR/ |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 89 | |
| 90 | cp $V ${TOPDIR}external/sonivox/docs/JET_Authoring_Guidelines.html $JETDOC/ |
| 91 | cp -r $V ${TOPDIR}external/sonivox/docs/JET_Authoring_Guidelines_files $JETDOC/ |
| 92 | cp $V ${TOPDIR}external/sonivox/docs/JET_Creator_User_Manual.html $JETDOC/ |
| 93 | cp -r $V ${TOPDIR}external/sonivox/docs/JET_Creator_User_Manual_files $JETDOC/ |
| 94 | |
| 95 | # Copy or move platform specific tools to the default platform. |
| 96 | cp $V ${TOPDIR}dalvik/dx/etc/dx.bat $PLATFORM_TOOLS/ |
Raphael Moll | 2f61396 | 2010-09-27 16:20:07 -0700 | [diff] [blame] | 97 | mv $V $TOOLS/{adb.exe,aapt.exe,aidl.exe,dexdump.exe} $TOOLS/Adb*.dll $PLATFORM_TOOLS/ |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 98 | |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 99 | # Fix EOL chars to make window users happy - fix all files at the top level |
| 100 | # as well as all batch files including those in platforms/<name>/tools/ |
Raphael Moll | 1fe58f3 | 2010-11-11 15:58:28 -0800 | [diff] [blame^] | 101 | if [[ -x $UNIX2DOS ]]; then |
| 102 | find $TEMP_SDK_DIR -maxdepth 1 -name "*.[ht]*" -type f -print0 | xargs -0 $UNIX2DOS |
| 103 | find $TEMP_SDK_DIR -maxdepth 3 -name "*.bat" -type f -print0 | xargs -0 $UNIX2DOS |
| 104 | fi |
| 105 | |
| 106 | # Execute the packaging script in the sdk directory |
| 107 | ${TOPDIR}sdk/build/patch_windows_sdk.sh $Q ${TEMP_SDK_DIR} ${WIN_OUT_DIR} ${TOPDIR} |
Raphael | 0e4dd61 | 2010-04-16 17:37:25 -0700 | [diff] [blame] | 108 | |
| 109 | # Just to make it easier on the build servers, we want fastboot and adb (and its DLLs) |
| 110 | # next to the new SDK, so up one dir. |
| 111 | for i in fastboot.exe adb.exe AdbWinApi.dll AdbWinUsbApi.dll; do |
| 112 | cp -f $V $WIN_OUT_DIR/host/windows-x86/bin/$i $TEMP_SDK_DIR/../$i |
| 113 | done |