]> git.sesse.net Git - vlc/blobdiff - extras/contrib/bootstrap
contribs: fixed hardcoded paths
[vlc] / extras / contrib / bootstrap
index 85f8eb1ad629695ac17a59613c5c1db32c65ae5e..9d32354ec8846dce7b47f2e4ed9e184c12cbef51 100755 (executable)
@@ -149,14 +149,6 @@ rm -f "${config_mak}"
     echo "# Make changes if you know what you're doing."
 } > "${config_mak}"
 
-# Create distro.mak
-distro_mak="${BUILDDIR}/distro.mak"
-rm -f "${distro_mak}"
-{
-    echo "# Automatically generated by bootstrap"
-    echo "# Make changes if you know what you're doing."
-} > "${distro_mak}"
-
 if test "$TARGET" != "$BUILD"; then
     test -z "$CC"    && CC="${TARGET}-gcc"
     test -z "$CXX"   && CXX="${TARGET}-g++"
@@ -200,6 +192,9 @@ case $TARGET in
     *wince*)
         add_enabled_makefile_cfg "HAVE_WINCE"
     ;;
+    *symbian*)
+        add_enabled_makefile_cfg "HAVE_SYMBIAN"
+    ;;
 esac
 
 # Figure out the correct distro to use
@@ -215,9 +210,6 @@ case $TARGET in
 
         CFLAGS_TUNING=" -arch ppc -mtune=G4"
         EXTRA_LDFLAGS=" -arch ppc"
-
-        # FIXME - this one seems to be redundant?
-        LD="ld -arch ppc -syslibroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
     ;;
     i686-apple-darwin*)
         hint_distro macosx32
@@ -267,12 +259,10 @@ case $TARGET in
     ;;
     arm-none-linux-gnueabi)
         if test -f /etc/maemo_version; then
-            hint_distro maemo
+            hint_distro maemo5
             EXTRA_CFLAGS=" -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a"
             EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpu=neon -mfloat-abi=softfp"
             EXTRA_CFLAGS="$EXTRA_CFLAGS -O3 -fno-tree-vectorize"
-        else
-            EXTRA_CFLAGS="-msoft-float"
         fi
     ;;
     *86_64*linux*)
@@ -302,7 +292,7 @@ if test -z "${DISTRO}" -a "$TARGET" = "$BUILD"; then
     if test -f /etc/fedora-release; then
         hint_distro fedora
     elif test -f /etc/maemo_version; then
-        hint_distro maemo
+        hint_distro maemo5
     elif test -f /etc/debian_version; then
         # NOTE: check for Debian *after* its derivatives
         hint_distro debian
@@ -312,7 +302,9 @@ fi
 # Default Unix-like systems
 hint_distro unix
 
-cat src/Distributions/"${DISTRO}".mak >> "${distro_mak}"
+distro_mak="${BUILDDIR}/distro.mak"
+distro_file="`pwd`/src/Distributions/${DISTRO}.mak"
+ln -sf "${distro_file}" "${distro_mak}"
 
 #
 # Distro specific settings
@@ -332,15 +324,22 @@ case "$DISTRO" in
     HAVE_MACOSX_DARWIN_9=1
     EXTRA_LDFLAGS="${EXTRA_LDFLAGS} -isysroot \${MACOSX_SDK} -Wl,-syslibroot,\${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
     EXTRA_CFLAGS="${EXTRA_CFLAGS} -D\${ENVP} -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
-    CC="/usr/bin/gcc-4.2"
-    CXX="/usr/bin/g++-4.2"
+    CC="/usr/bin/gcc"
+    CXX="/usr/bin/g++"
+    LD="ld"
+    RANLIB="ranlib"
+    AR=
+    STRIP="strip"
     add_makefile_cfg "PATH = /bin:/usr/bin:/usr/local/bin"
     add_makefile_cfg "SDK_TARGET = ${SDK_TARGET}"
     add_makefile_cfg "ENVP = MACOSX_DEPLOYMENT_TARGET=${SDK_TARGET}"
     add_makefile_cfg "MACOSX_SDK = /Developer/SDKs/MacOSX${SDK_TARGET}.sdk"
+    add_enabled_makefile_cfg "HAVE_MACOSX"
 
     case $TARGET in
     x86_64*|i686*) add_enabled_makefile_cfg "HAVE_MACOSX_ON_INTEL" ;;
+    esac
+    case $TARGET in
     *darwin10)     add_enabled_makefile_cfg "HAVE_MACOSX_DARWIN_10" ;;
     *darwin9)      add_enabled_makefile_cfg "HAVE_MACOSX_DARWIN_9" ;;
     esac
@@ -353,6 +352,36 @@ case "$DISTRO" in
   win*)
     add_makefile_cfg "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig"
     ;;
+  android)
+    if test -z "$ANDROID_NDK"; then
+        error "The bootstrap script requires the ANDROID_NDK environment variable "
+        error "to be set when building for Android"
+        exit 1
+    fi
+    # The given host (arm-eabi) is not the real one (arm-linux-androideabi)
+    ln -sfn $TARGET hosts/arm-linux-androideabi
+    CC="arm-linux-androideabi-gcc --sysroot=$ANDROID_NDK/platforms/android-9/arch-arm"
+    CXX="arm-linux-androideabi-g++ --sysroot=$ANDROID_NDK/platforms/android-9/arch-arm"
+    NM=arm-linux-androideabi-nm
+    AR=arm-linux-androideabi-ar
+    LD=arm-linux-androideabi-ld
+    RANLIB=arm-linux-androideabi-ranlib
+    STRIP=arm-linux-androideabi-strip
+    # Add the PATH to the NDK
+    add_makefile_cfg "ANDROID_NDK = ${ANDROID_NDK}"
+    add_makefile_cfg "PATH = ${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/:${PATH}"
+
+    add_enabled_makefile_cfg "HAVE_LINUX"
+    if test -z "$NO_NEON"; then
+        add_enabled_makefile_cfg "HAVE_NEON"
+        ARM_EABI=armeabi-v7a
+    else
+        ARM_EABI=armeabi
+    fi
+    # make sure android toolchain can build C++
+    EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -D__STDC_VERSION__=199901L"
+    EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/include"
+    EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/$ARM_EABI/include"
 esac
 
 # Save passed flags
@@ -383,18 +412,24 @@ add_makefile_cfg "EXTRA_LDFLAGS = ${EXTRA_LDFLAGS}"
 add_makefile_cfg "EXTRA_PATH = ${EXTRA_PATH}"
 
 #CMAKE
-if test "$TARGET" != "$BUILD"; then
-    toolchain_cmake="${BUILDDIR}/toolchain.cmake"
-    if test ${DISTRO} = "win32"; then
-        echo "SET(CMAKE_SYSTEM_NAME Windows)" >> "${toolchain_cmake}"
-    fi
-    echo "SET(CMAKE_C_COMPILER ${CC})" >> "${toolchain_cmake}"
-    echo "SET(CMAKE_CXX_COMPILER ${CXX})" >> "${toolchain_cmake}"
-    echo "SET(CMAKE_FIND_ROOT_PATH  `pwd` )" >> "${toolchain_cmake}"
-    echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> "${toolchain_cmake}"
-    echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> "${toolchain_cmake}"
-    echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> "${toolchain_cmake}"
+toolchain_cmake="${BUILDDIR}/toolchain.cmake"
+rm -f ${BUILDDIR}/toolchain.cmake
+if test ${DISTRO} = "win32"; then
+    echo "SET(CMAKE_SYSTEM_NAME Windows)" >> "${toolchain_cmake}"
+    echo "SET(CMAKE_RC_COMPILER ${TARGET}-windres)" >> "${toolchain_cmake}"
 fi
+case "$DISTRO" in macosx*)
+    echo "SET(CMAKE_SYSTEM_NAME Darwin)" >> "${toolchain_cmake}"
+    echo "set(CMAKE_C_FLAGS ${CFLAGS_TUNING} ${EXTRA_CFLAGS})" >> "${toolchain_cmake}"
+    echo "set(CMAKE_CXX_FLAGS ${CFLAGS_TUNING} ${EXTRA_CFLAGS})" >> "${toolchain_cmake}"
+    echo "set(CMAKE_LD_FLAGS ${EXTRA_LDFLAGS})" >> "${toolchain_cmake}"
+esac
+echo "SET(CMAKE_C_COMPILER ${CC})" >> "${toolchain_cmake}"
+echo "SET(CMAKE_CXX_COMPILER ${CXX})" >> "${toolchain_cmake}"
+echo "SET(CMAKE_FIND_ROOT_PATH  `pwd` )" >> "${toolchain_cmake}"
+echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> "${toolchain_cmake}"
+echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> "${toolchain_cmake}"
+echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> "${toolchain_cmake}"
 
 if wget --version >/dev/null 2>&1; then
     add_makefile_cfg "WGET = \"`which wget`\" -c --passive"
@@ -428,26 +463,26 @@ fi
 
 if test $HAVE_MACOSX_DARWIN_9; then
     add_enabled_makefile_cfg "HAVE_MACOSX_DARWIN_9"
-    if ! /usr/bin/gcc-4.2 --version>/dev/null 2>&1; then
-        error "You do not have GCC-4.2 installed in /usr/bin, compilation WILL FAIL."
+    if ! /usr/bin/gcc --version>/dev/null 2>&1; then
+        error "You do not have GCC installed in /usr/bin, compilation WILL FAIL."
     fi
 fi
 
 if test "$DISTRO" = "macosx32"; then
     info "*****************************************************************"
-    info "* VLC will be compiled in 32bit mode.                           *"
+    info "* VLC will be compiled in 32bit mode using the 10.5 & later SDK.*"
     info "*                                                               *"
-    info "* Re-run with the x86_64-apple-darwin* argument to turn on      *"
+    info "* Re-run with the -t x86_64-apple-darwin* argument to turn on   *"
     info "* 64bit compilation for Intel-based Macs, whereas * is either   *"
     info "* 9 or 10 depending on your Darwin version.                     *"
-    info "* There is NO PPC64 support right now.                          *"
+    info "* There is no PPC64 support.                                    *"
     info "*****************************************************************"
 fi
 
 if test "$DISTRO" = "macosx64"; then
     info
     info "*****************************************************************"
-    info "* VLC will be compiled in 64bit mode using the 10.5 SDK.        *"
+    info "* VLC will be compiled in 64bit mode using the 10.5 & later SDK.*"
     info "*****************************************************************"
 fi
 
@@ -455,9 +490,9 @@ case `uname` in
     Linux)
         CPUS=`grep -c ^processor /proc/cpuinfo`
      ;;
-    Darwin)
-        CPUS=`sysctl hw.ncpu|cut -d: -f2`
-    ;;
+#    Darwin)
+#        CPUS=`sysctl hw.ncpu|cut -d: -f2`
+#    ;;
     *)
         CPUS=1  # default
      ;;