Make it possible to force a distro.mak to use. This is helpfull in cross-compile...
authorJean-Paul Saman <jpsaman@videolan.org>
Mon, 14 May 2007 12:07:35 +0000 (12:07 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Mon, 14 May 2007 12:07:35 +0000 (12:07 +0000)
extras/contrib/bootstrap

index 7fe6bf7..3ae923a 100755 (executable)
@@ -24,9 +24,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 # ***************************************************************************
 
-if test "$#" -gt "1"; then
-  echo "Usage: $0 <host>" >&2
-  echo "  Prepare config.mak file." >&2
+if test "$#" -gt "2"; then
+  echo "Usage: $0 <host> [distro]" >&2
+  echo "  Prepare config.mak and distro.mak file." >&2
   exit 1
 fi
 
@@ -42,6 +42,13 @@ else
   HOST="$BUILD"
 fi
 
+DISTRO=
+if test "$#" = "2"; then
+    echo "Forcing distro.mak to use $2.mak"
+    DISTRO="$2"
+    HOST="$1"
+fi
+
 rm -f config.mak
 {
        echo "# Automatically generated by bootstrap."
@@ -83,7 +90,7 @@ case $HOST in
            EXTRA_CFLAGS=" -D\${ENVP} -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
            EXTRA_LDFLAGS=" -isysroot \${MACOSX_SDK} -Wl,-syslibroot,\${MACOSX_SDK}"
            echo "PATH = /bin:/usr/bin:/usr/local/bin" >> config.mak
-        cat src/Distributions/darwin.mak >> distro.mak
+           cat src/Distributions/darwin.mak >> distro.mak
         ;;
     i686-apple-darwin8)
            SDK_TARGET=10.4
@@ -96,7 +103,7 @@ case $HOST in
            EXTRA_CFLAGS=" -D\${ENVP} -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
            EXTRA_LDFLAGS=" -isysroot \${MACOSX_SDK} -Wl,-syslibroot,\${MACOSX_SDK}"
            echo "PATH = /bin:/usr/bin:/usr/local/bin" >> config.mak
-        cat src/Distributions/darwin.mak >> distro.mak
+           cat src/Distributions/darwin.mak >> distro.mak
         ;;
     powerpc-apple-darwin9)
            SDK_TARGET=10.4
@@ -108,7 +115,7 @@ case $HOST in
 #          EXTRA_CFLAGS=" -D\${ENVP} -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
 #          EXTRA_LDFLAGS=" -isysroot \${MACOSX_SDK} -Wl,-syslibroot,\${MACOSX_SDK}"
            echo "PATH = /bin:/usr/bin:/usr/local/bin" >> config.mak
-        cat src/Distributions/darwin.mak >> distro.mak
+           cat src/Distributions/darwin.mak >> distro.mak
         ;;
     i686-apple-darwin9)
            SDK_TARGET=10.4
@@ -121,7 +128,7 @@ case $HOST in
 #          EXTRA_CFLAGS=" -D\${ENVP} -isysroot \${MACOSX_SDK} -mmacosx-version-min=\${SDK_TARGET}"
 #          EXTRA_LDFLAGS=" -isysroot \${MACOSX_SDK} -Wl,-syslibroot,\${MACOSX_SDK}"
            echo "PATH = /bin:/usr/bin:/usr/local/bin" >> config.mak
-        cat src/Distributions/darwin.mak >> distro.mak
+           cat src/Distributions/darwin.mak >> distro.mak
         ;;
     i586-pc-beos)
             echo "HAVE_BEOS = 1" >> config.mak
@@ -173,21 +180,27 @@ case $HOST in
         ;;
     *)
             if test "$HOST" = "$BUILD"; then
-               if test -d "/usr/lib/pkgconfig"; then
-                   if test -z "$PKG_CONFIG_PATH"; then
-                       echo "PKG_CONFIG_PATH = /usr/lib/pkgconfig" >> config.mak
-                   fi
-                   if test -z "$PKG_CONFIG_LIBDIR"; then
-                       echo "PKG_CONFIG_LIBDIR = /usr/lib/pkgconfig" >> config.mak
-                   fi
-               fi
-            fi
-            # Try to match distribution
-            if test -f /etc/fedora-release; then
-                cat src/Distributions/fedora.mak >> distro.mak
-            else
-                # Default Unix-like systems
-                cat src/Distributions/unix.mak >> distro.mak
+                if test -d "/usr/lib/pkgconfig"; then
+                    if test -z "$PKG_CONFIG_PATH"; then
+                        echo "PKG_CONFIG_PATH = /usr/lib/pkgconfig" >> config.mak
+                    fi
+                    if test -z "$PKG_CONFIG_LIBDIR"; then
+                        echo "PKG_CONFIG_LIBDIR = /usr/lib/pkgconfig" >> config.mak
+                    fi
+                fi
+                # Try to match distribution
+                if test -f /etc/fedora-release; then
+                    cat src/Distributions/fedora.mak >> distro.mak
+                else
+                    # Default Unix-like systems
+                    cat src/Distributions/unix.mak >> distro.mak
+                fi
+            else # unknown distro
+                if test ! -z "${DISTRO}";  then
+                    cat src/Distributions/${DISTRO}.mak >> distro.mak
+                else
+                    cat src/Distributions/unix.mak >> distro.mak
+                fi
             fi
         ;;
 esac