modules/freetype2/autogen.sh

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 #!/bin/sh
michael@0 2
michael@0 3 # Copyright 2005-2010, 2013 by
michael@0 4 # David Turner, Robert Wilhelm, and Werner Lemberg.
michael@0 5 #
michael@0 6 # This file is part of the FreeType project, and may only be used, modified,
michael@0 7 # and distributed under the terms of the FreeType project license,
michael@0 8 # LICENSE.TXT. By continuing to use, modify, or distribute this file you
michael@0 9 # indicate that you have read the license and understand and accept it
michael@0 10 # fully.
michael@0 11
michael@0 12 run ()
michael@0 13 {
michael@0 14 echo "running \`$*'"
michael@0 15 eval $*
michael@0 16
michael@0 17 if test $? != 0 ; then
michael@0 18 echo "error while running \`$*'"
michael@0 19 exit 1
michael@0 20 fi
michael@0 21 }
michael@0 22
michael@0 23 get_major_version ()
michael@0 24 {
michael@0 25 echo $1 | sed -e 's/\([0-9][0-9]*\)\..*/\1/g'
michael@0 26 }
michael@0 27
michael@0 28 get_minor_version ()
michael@0 29 {
michael@0 30 echo $1 | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'
michael@0 31 }
michael@0 32
michael@0 33 get_patch_version ()
michael@0 34 {
michael@0 35 # tricky: some version numbers don't include a patch
michael@0 36 # separated with a point, but something like 1.4-p6
michael@0 37 patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'`
michael@0 38 if test "$patch" = "$1"; then
michael@0 39 patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\-p\([0-9][0-9]*\).*/\1/g'`
michael@0 40 # if there isn't any patch number, default to 0
michael@0 41 if test "$patch" = "$1"; then
michael@0 42 patch=0
michael@0 43 fi
michael@0 44 fi
michael@0 45 echo $patch
michael@0 46 }
michael@0 47
michael@0 48 # $1: version to check
michael@0 49 # $2: minimum version
michael@0 50
michael@0 51 compare_to_minimum_version ()
michael@0 52 {
michael@0 53 MAJOR1=`get_major_version $1`
michael@0 54 MAJOR2=`get_major_version $2`
michael@0 55 if test $MAJOR1 -lt $MAJOR2; then
michael@0 56 echo 0
michael@0 57 return
michael@0 58 else
michael@0 59 if test $MAJOR1 -gt $MAJOR2; then
michael@0 60 echo 1
michael@0 61 return
michael@0 62 fi
michael@0 63 fi
michael@0 64
michael@0 65 MINOR1=`get_minor_version $1`
michael@0 66 MINOR2=`get_minor_version $2`
michael@0 67 if test $MINOR1 -lt $MINOR2; then
michael@0 68 echo 0
michael@0 69 return
michael@0 70 else
michael@0 71 if test $MINOR1 -gt $MINOR2; then
michael@0 72 echo 1
michael@0 73 return
michael@0 74 fi
michael@0 75 fi
michael@0 76
michael@0 77 PATCH1=`get_patch_version $1`
michael@0 78 PATCH2=`get_patch_version $2`
michael@0 79 if test $PATCH1 -lt $PATCH2; then
michael@0 80 echo 0
michael@0 81 else
michael@0 82 echo 1
michael@0 83 fi
michael@0 84 }
michael@0 85
michael@0 86 # check the version of a given tool against a minimum version number
michael@0 87 #
michael@0 88 # $1: tool path
michael@0 89 # $2: tool usual name (e.g. `aclocal')
michael@0 90 # $3: tool variable (e.g. `ACLOCAL')
michael@0 91 # $4: minimum version to check against
michael@0 92 # $5: option field index used to extract the tool version from the
michael@0 93 # output of --version
michael@0 94
michael@0 95 check_tool_version ()
michael@0 96 {
michael@0 97 field=$5
michael@0 98 # assume the output of "[TOOL] --version" is "toolname (GNU toolname foo bar) version"
michael@0 99 if test "$field"x = x; then
michael@0 100 field=3 # default to 3 for all GNU autotools, after filtering enclosed string
michael@0 101 fi
michael@0 102 version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field`
michael@0 103 version_check=`compare_to_minimum_version $version $4`
michael@0 104 if test "$version_check"x = 0x; then
michael@0 105 echo "ERROR: Your version of the \`$2' tool is too old."
michael@0 106 echo " Minimum version $4 is required (yours is version $version)."
michael@0 107 echo " Please upgrade or use the $3 variable to point to a more recent one."
michael@0 108 echo ""
michael@0 109 exit 1
michael@0 110 fi
michael@0 111 }
michael@0 112
michael@0 113 if test ! -f ./builds/unix/configure.raw; then
michael@0 114 echo "You must be in the same directory as \`autogen.sh'."
michael@0 115 echo "Bootstrapping doesn't work if srcdir != builddir."
michael@0 116 exit 1
michael@0 117 fi
michael@0 118
michael@0 119 # On MacOS X, the GNU libtool is named `glibtool'.
michael@0 120 HOSTOS=`uname`
michael@0 121 if test "$LIBTOOLIZE"x != x; then
michael@0 122 :
michael@0 123 elif test "$HOSTOS"x = Darwinx; then
michael@0 124 LIBTOOLIZE=glibtoolize
michael@0 125 else
michael@0 126 LIBTOOLIZE=libtoolize
michael@0 127 fi
michael@0 128
michael@0 129 if test "$ACLOCAL"x = x; then
michael@0 130 ACLOCAL=aclocal
michael@0 131 fi
michael@0 132
michael@0 133 if test "$AUTOCONF"x = x; then
michael@0 134 AUTOCONF=autoconf
michael@0 135 fi
michael@0 136
michael@0 137 check_tool_version $ACLOCAL aclocal ACLOCAL 1.10.1
michael@0 138 check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
michael@0 139 check_tool_version $AUTOCONF autoconf AUTOCONF 2.62
michael@0 140
michael@0 141 # This sets freetype_major, freetype_minor, and freetype_patch.
michael@0 142 eval `sed -nf version.sed include/freetype.h`
michael@0 143
michael@0 144 # We set freetype-patch to an empty value if it is zero.
michael@0 145 if test "$freetype_patch" = ".0"; then
michael@0 146 freetype_patch=
michael@0 147 fi
michael@0 148
michael@0 149 cd builds/unix
michael@0 150
michael@0 151 echo "generating \`configure.ac'"
michael@0 152 sed -e "s;@VERSION@;$freetype_major$freetype_minor$freetype_patch;" \
michael@0 153 < configure.raw > configure.ac
michael@0 154
michael@0 155 run aclocal -I . --force
michael@0 156 run $LIBTOOLIZE --force --copy --install
michael@0 157 run autoconf --force
michael@0 158
michael@0 159 chmod +x mkinstalldirs
michael@0 160 chmod +x install-sh
michael@0 161
michael@0 162 cd ../..
michael@0 163
michael@0 164 chmod +x ./configure
michael@0 165
michael@0 166 # EOF

mercurial