]> git.sesse.net Git - mlt/blob - configure
version shunt
[mlt] / configure
1 #!/bin/bash
2
3 function show_help
4 {
5         cat << EOF
6 Non-autotool config script for MLT.
7
8 Help options:
9
10   --help                  - this information
11
12 General build options:
13
14   --prefix=directory      - install prefix for path (default: $prefix)
15   --enable-gpl            - Enable GPL components
16   --disable-debug         - Compile without debug support (default: on)
17   --disable-mmx           - Compile without MMX support (default: on)
18   --cpu='cpu'             - Compile for a specific CPU/architectre (default: none)
19
20 Module disables options:
21
22 EOF
23
24         for i in src/modules/*
25         do
26                 [ -d $i ] && [ "`basename $i`" != "CVS" ] && echo `basename $i` `[ -f $i/gpl ] && echo [GPL]`
27         done |
28         awk '{ printf( "  --disable-%-14.14s- Disable the %s module %s\n", $1, $1, $2 ); }'
29
30         echo
31         echo "  NOTE: libraries marked [GPL] will not be built unless --enable-gpl is stipulated."
32         echo
33 }
34
35 function build_config
36 {
37         (
38                 echo "version=$version"
39                 echo "prefix=$prefix"
40                 echo "bindir=$prefix/bin"
41
42                 [ "$mmx" = "true" ] && 
43                 echo "MMX_FLAGS=-DUSE_MMX"
44
45                 [ "$debug" = "true" ] && 
46                 echo "DEBUG_FLAGS=-g"
47
48                 echo "LARGE_FILE=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
49
50                 [ "$cpu" != "" ] &&
51                 echo "TARGETARCH=-march=$cpu" &&
52                 echo "TARGETCPU=-mcpu=$cpu"
53
54                 [ "`uname`" = "Linux" ] &&
55                 echo "LIBDL=-ldl"
56
57                 echo "OPTIMISATIONS=-O4 -pipe -ffast-math -fomit-frame-pointer"
58                 echo "CFLAGS+=-Wall \$(TARGETARCH) \$(TARGETCPU) \$(OPTIMISATIONS) \$(MMX_FLAGS) \$(DEBUG_FLAGS) \$(LARGE_FILE) -pthread"
59         ) > config.mak
60
61         echo "#!/bin/sh" > mlt-config
62         (
63                 echo export version=$version
64                 echo export prefix=$prefix
65                 echo export bindir=$prefix/bin
66         ) >> mlt-config
67
68         cat < mlt-config-template >> mlt-config
69
70         echo -n > packages.dat
71 }
72
73 function build_pkgconfig
74 {
75         for i in framework valerie miracle
76         do
77                 echo "prefix=$prefix" >mlt-$i.pc
78                 echo "exec_prefix=$prefix" >>mlt-$i.pc
79                 echo "libdir=$prefix/lib" >>mlt-$i.pc
80                 echo "includedir=$prefix/include" >>mlt-$i.pc
81                 echo "version=$version" >>mlt-$i.pc
82                 echo "cflags=`grep ^$i packages.dat | cut -f 2`" >>mlt-$i.pc
83                 echo "libs=`grep ^$i packages.dat | cut -f 3`" >>mlt-$i.pc
84                 cat mlt-$i.pc.in >>mlt-$i.pc
85         done
86 }
87
88 # Debug mode
89 set +x
90
91 # Define build directory for scripts called
92 export build_dir=`dirname $0`
93 export prefix=/usr/local
94 export help=0
95 export version=0.1.0
96 export debug=true
97 export mmx=true
98 export gpl=false
99 export cpu=
100
101 # Iterate through arguments
102 for i in "$@"
103 do
104         case $i in
105                 --help )                        help=1 ;;
106                 --prefix=* )            prefix="${i#--prefix=}" ;;
107                 --disable-debug )       debug=false ;;
108                 --disable-mmx )         mmx=false ;;
109                 --enable-gpl )          gpl=true ;;
110                 --cpu=* )                       cpu="${i#--cpu=}" ;;
111         esac
112 done
113
114 # Show help if requested
115 [ $help = 1 ] && show_help || build_config
116
117 # Iterate through each of the components
118 for i in framework modules inigo valerie miracle humperdink
119 do
120         if [ -x src/$i/configure ]
121         then
122                 [ $help = 0 ] && echo "Configuring `basename $i`:"
123                 pushd src/$i > /dev/null
124                 ./configure "$@"
125                 [ $? != 0 ] && exit 1
126                 popd > /dev/null
127         fi
128 done
129
130 # Build the pkg-config files
131 build_pkgconfig
132
133 # Report GPL Usage
134 [ $help != 1 ] && 
135 ( [ "$gpl" = "false" ] && 
136 echo "GPL Components are disabled" || 
137 echo "GPL License Used" )
138