bootstrap 5.24 KB
Newer Older
1
2
3
4
#!/bin/sh
# ***************************************************************************
# bootstrap : Set up config.mak
# ***************************************************************************
5
# Copyright (C) 2003-2006 the VideoLAN team
6
# $Id$
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Authors: Christophe Massiot <massiot@via.ecp.fr>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
dionoea's avatar
dionoea committed
22
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23
24
# ***************************************************************************

25
26
if test "$#" -gt "1"; then
  echo "Usage: $0 <host>" >&2
27
28
29
30
31
32
33
34
35
  echo "  Prepare config.mak file." >&2
  exit 1
fi

LANG=C
export LANG
set -e
set -x

36
37
38
BUILD=`gcc -dumpmachine`
if test "$#" = "1"; then
  HOST="$1"
39
else
40
  HOST="$BUILD"
41
42
fi

43
44
rm -f config.mak
echo -e "# Automatically generated by bootstrap.\n# Make changes if you know what you're doing.\n" > config.mak
45
46
47
48

echo "BUILD = $BUILD" >> config.mak
echo "HOST = $HOST" >> config.mak

49
50
echo "PREFIX = `pwd`" >> config.mak

51
52
53
if test "$HOST" != "$BUILD"; then
    CC="${HOST}-gcc"
    CXX="${HOST}-g++"
54
    LD="${HOST}-ld"
55
56
57
58
    RANLIB="${HOST}-ranlib"
    AR="${HOST}-ar"
fi

59
case $HOST in
60
61
    ppc-darwin)
# Mac OS X < 10.4
62
	    echo "HAVE_DARWIN_OS = 1" >> config.mak
63
	    EXTRA_CPPFLAGS=" -no-cpp-precomp"
64
	    echo "PATH = /bin:/usr/bin" >> config.mak
65
	;;
66
    powerpc-apple-darwin8|i686-apple-darwin8)
67
68
69
70
# Mac OS X 10.4
# Makefile cross compiling is only supported with gcc-4.0
# ENVP defines the oldest environment on which the program will be able to run
# SDK 10.2.8 requires gcc-3.3 (so we cannot use that SDK)
71
72
            SDK_TARGET=10.3
            echo "SDK_TARGET = ${SDK_TARGET}" >> config.mak
73
	    echo "HAVE_DARWIN_OS = 1" >> config.mak
74
75
            echo "ENVP = MACOSX_DEPLOYMENT_TARGET=${SDK_TARGET}" >> config.mak
	    echo "MACOSX_SDK = /Developer/SDKs/MacOSX10.3.9.sdk" >> config.mak
76
77
#	    EXTRA_CFLAGS=" -D\${ENVP} -isysroot \${MACOSX_SDK}"
#	    EXTRA_LDFLAGS=" -isysroot \${MACOSX_SDK} -Wl,-syslibroot,\${MACOSX_SDK}"
78
	    echo "PATH = /bin:/usr/bin:/usr/local/bin" >> config.mak
79
80
        ;;
    i586-pc-beos)
81
            echo "HAVE_BEOS = 1" >> config.mak
82
            if test -f /boot/beos/system/lib/libbind.so; then
83
                EXTRA_LDFLAGS=" -lbind -lsocket"
84
            else
85
                EXTRA_LDFLAGS=" -lnet"
86
            fi
87
            if test "$HOST" = "$BUILD"; then
88
89
90
91
92
93
94
95
96
#               Compiling on BeOS
                PATH=".:/boot/home/config/bin:/bin:/boot/apps"
                PATH="${PATH}:/boot/preferences:/boot/beos/apps"
                PATH="${PATH}:/boot/beos/preferences"
                PATH="${PATH}:/boot/develop/tools/gnupro/bin"
                echo "PATH = ${PATH}" >> config.mak
                LIBRARY_PATH="${LIBRARY_PATH}:%A/lib:/boot/home/config/lib"
                LIBRARY_PATH="${LIBRARY_PATH}:/boot/beos/system/lib"
                echo "LIBRARY_PATH = ${LIBRARY_PATH}" >> config.mak
97
            else
98
99
100
101
#               Cross compiling from Linux
                PATH="/opt/beos-tools/bin:/opt/cross-tools/bin"
                PATH="${PATH}:/usr/bin:/bin"
                echo "PATH = ${PATH}" >> config.mak
102
            fi
103
        ;;
104
105
    i586-mingw32msvc)
            echo "HAVE_WIN32 = 1" >> config.mak
106
            echo "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig" >> config.mak
107
108
109
        ;;
    i686-pc-cygwin)
            echo "HAVE_WIN32 = 1" >> config.mak
110
111
            CC="gcc -mno-cygwin"
            CXX="g++ -mno-cygwin"
112
113
114
            EXTRA_CFLAGS=" -mno-cygwin"
            EXTRA_CPPFLAGS=" -mno-cygwin"
            EXTRA_LDFLAGS=" -mno-cygwin"
115
            echo "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig" >> config.mak
116
117
118
119
        ;;
    arm-wince-pe)
            echo "HAVE_WINCE = 1" >> config.mak
            echo "PKG_CONFIG_PATH = \$(PREFIX)/lib/pkgconfig" >> config.mak
120
            EXTRA_CPPFLAGS=" -D_WIN32_WCE"
121
        ;;
122
123
124
125
    *)
        ;;
esac

126
127
echo "CC = ${CC}" >> config.mak
echo "CXX = ${CXX}" >> config.mak
128
echo "LD = ${LD}" >> config.mak
129
130
131
132
133
134
echo "RANLIB = ${RANLIB}" >> config.mak
echo "AR = ${AR}" >> config.mak
echo "EXTRA_CFLAGS = ${EXTRA_CFLAGS}" >> config.mak
echo "EXTRA_CPPFLAGS = ${EXTRA_CPPFLAGS}" >> config.mak
echo "EXTRA_LDFLAGS = ${EXTRA_LDFLAGS}" >> config.mak
echo "EXTRA_PATH = ${EXTRA_PATH}" >> config.mak
135

136
137
if which curl >/dev/null; then
	echo "WGET = curl -O" >> config.mak
138
elif wget --version >/dev/null 2>&1; then
139
140
141
142
143
144
	echo "WGET = wget" >> config.mak
else
	echo "You need at least wget or curl to fetch the packages." >&2
	exit 1
fi

bigben's avatar
bigben committed
145
146
if test -f /sw/bin/svn; then
        echo "SVN = /sw/bin/svn" >> config.mak
147
148
elif test -f /usr/local/bin/svn; then
        echo "SVN = /usr/local/bin/svn" >> config.mak
bigben's avatar
bigben committed
149
150
151
152
153
elif svn help >/dev/null 2>&1; then
        echo "SVN = svn" >> config.mak
else
        echo "You do not have a subversion client installed." >&2
fi