]> git.sesse.net Git - vlc/blobdiff - extras/contrib/bootstrap
Fluidsynth: revector initialization, no functional changes
[vlc] / extras / contrib / bootstrap
index c44d8d8413862fd54dc6f819993170971fb60b04..f45a7217f70d9f6847f3d36fef7a1d6f8dd38d2d 100755 (executable)
@@ -48,6 +48,11 @@ add_makefile_cfg()
     echo $1 >> "${config_mak}"
 }
 
+add_enabled_makefile_cfg()
+{
+    echo "$1=1" >> "${config_mak}"
+}
+
 error()
 {
     echo "[contrib] ERROR: $1"
@@ -144,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++"
@@ -183,17 +180,20 @@ add_makefile_cfg "ARCH = $ARCH"
 # Check the HAVE_{OS}
 case $TARGET in
     *darwin*)
-        add_makefile_cfg "HAVE_DARWIN_OS = 1"
-        add_makefile_cfg "HAVE_BSD = 1"
+        add_enabled_makefile_cfg "HAVE_DARWIN_OS"
+        add_enabled_makefile_cfg "HAVE_BSD"
     ;;
     *linux*)
-        add_makefile_cfg "HAVE_LINUX = 1"
+        add_enabled_makefile_cfg "HAVE_LINUX"
     ;;
     *bsd*)
-        add_makefile_cfg "HAVE_BSD = 1"
+        add_enabled_makefile_cfg "HAVE_BSD"
     ;;
     *wince*)
-        add_makefile_cfg "HAVE_WINCE = 1"
+        add_enabled_makefile_cfg "HAVE_WINCE"
+    ;;
+    *symbian*)
+        add_enabled_makefile_cfg "HAVE_SYMBIAN"
     ;;
 esac
 
@@ -205,91 +205,64 @@ case $TARGET in
         exit 1
     ;;
     powerpc-apple-darwin9)
-        hint_distro darwin
+        hint_distro macosx32
         HAVE_DARWIN_32=1
 
         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 darwin
+        hint_distro macosx32
         HAVE_DARWIN_32=1
 
         CFLAGS_TUNING=" -march=prescott -mtune=generic -arch i386 -m32"
         EXTRA_LDFLAGS=" -arch i386"
-
-        add_makefile_cfg "HAVE_DARWIN_OS_ON_INTEL = 1"
-        if test $TARGET = "i686-apple-darwin10"; then
-            add_makefile_cfg "HAVE_DARWIN_10 = 1"
-        fi
     ;;
     x86_64-apple-darwin*)
-        hint_distro darwin64
+        hint_distro macosx64
         HAVE_DARWIN_64=1
 
         CFLAGS_TUNING=" -march=core2 -mtune=core2 -m64 -arch x86_64"
         EXTRA_LDFLAGS=" -arch x86_64"
-
-        # FIXME - is this stuff needed?
-        LD="ld"
-        RANLIB="ranlib"
-        AR="ar"
-        STRIP="strip"
-
-        add_makefile_cfg "HAVE_DARWIN_OS_ON_INTEL = 1"
-        add_makefile_cfg "PATH = /bin:/usr/bin:/usr/local/bin"
-        if test $TARGET = "x86_64-apple-darwin10"; then
-            add_makefile_cfg "HAVE_DARWIN_10 = 1"
-        fi
     ;;
     *mingw32ce)
-        add_makefile_cfg "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig"
         EXTRA_CPPFLAGS=" -D_WIN32_WCE=0x0500"
         hint_distro wince
     ;;
     *64-*mingw*)
-        add_makefile_cfg "HAVE_WIN32 = 1"
-        add_makefile_cfg "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig"
+        add_enabled_makefile_cfg "HAVE_WIN32"
         EXTRA_CFLAGS="-O3"
         hint_distro win64
     ;;
     *mingw32*)
-        add_makefile_cfg "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig"
         EXTRA_CFLAGS=" -O3 -march=i686 -mtune=generic"
         hint_distro win32
     ;;
     i686-pc-cygwin)
-        add_makefile_cfg "HAVE_CYGWIN = 1"
+        add_enabled_makefile_cfg "HAVE_CYGWIN"
         CC="gcc -mno-cygwin -isystem /usr/include/mingw"
         CXX="g++ -mno-cygwin -isystem /usr/include/mingw"
         TARGET=`$CC -dumpmachine`
         EXTRA_CFLAGS=" -mno-cygwin -isystem /usr/include/mingw"
         EXTRA_CPPFLAGS=" -mno-cygwin -isystem /usr/include/mingw"
         EXTRA_LDFLAGS=" -mno-cygwin"
-        add_makefile_cfg "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig"
         hint_distro win32
     ;;
     arm-wince-pe)
-        add_makefile_cfg "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig"
         EXTRA_CPPFLAGS=" -D_WIN32_WCE"
         hint_distro wince
     ;;
     armeb-linux-uclibc)
-        add_makefile_cfg "HAVE_UCLIBC = 1"
-        add_makefile_cfg "HAVE_BIGENDIAN = 1"
+        add_enabled_makefile_cfg "HAVE_UCLIBC"
+        add_enabled_makefile_cfg "HAVE_BIGENDIAN"
         EXTRA_CFLAGS="-Os -march=armv5 -msoft-float"
     ;;
     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*)
@@ -319,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
@@ -329,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
@@ -344,23 +319,69 @@ case "$DISTRO" in
     fi
     add_makefile_cfg "IOS_SDK_ROOT = ${IOS_SDK_ROOT}"
     ;;
-  darwin*)
-    SDK_TARGET=10.5
-    HAVE_DARWIN_9=1
+  macosx*)
+    SDK_TARGET=10.6
+    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/clang"
+    CXX="/usr/bin/clang++"
+    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
 
     if ! test -e /Developer/SDKs; then
         error "Your Developer Tools' SDKs were not found.\nYou need to add extra symbolic links to /Developer to achieve correctly\nbuilt contribs.\nHave a look at the OSX-Compile-HOWTO for details." >&2
         exit 1
     fi
     ;;
+  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
@@ -370,7 +391,7 @@ EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS $CPPFLAGS"
 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $CXXFLAGS"
 
 uppercase_distro=`echo "$DISTRO" | tr '[:lower:]' '[:upper:]'`
-add_makefile_cfg "HAVE_${uppercase_distro} = 1"
+add_enabled_makefile_cfg "HAVE_${uppercase_distro}"
 add_makefile_cfg "BUILD = $BUILD"
 add_makefile_cfg "HOST = $TARGET"
 add_makefile_cfg "SRCDIR = `pwd`"
@@ -391,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"
@@ -434,30 +461,28 @@ if test -z "$CONTRIBS_RELEASE"; then
     info "*****************************************************************"
 fi
 
-if test $HAVE_DARWIN_9; then
-    add_makefile_cfg "HAVE_DARWIN_9 = 1"
-    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 test $HAVE_MACOSX_DARWIN_9; then
+    add_enabled_makefile_cfg "HAVE_MACOSX_DARWIN_9"
+    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 $HAVE_DARWIN_32; then
-    add_makefile_cfg "HAVE_DARWIN_32 = 1"
+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 $HAVE_DARWIN_64; then
-    add_makefile_cfg "HAVE_DARWIN_64 = 1"
+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
 
@@ -465,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
      ;;