Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | #!/bin/sh |
michael@0 | 2 | # |
michael@0 | 3 | # Copyright 2002-2006, 2008-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 | # |
michael@0 | 13 | # Call the `configure' script located in `builds/unix'. |
michael@0 | 14 | # |
michael@0 | 15 | |
michael@0 | 16 | rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk |
michael@0 | 17 | |
michael@0 | 18 | # respect GNUMAKE environment variable for backwards compatibility |
michael@0 | 19 | if test "x$GNUMAKE" = x; then |
michael@0 | 20 | if test "x$MAKE" = x; then |
michael@0 | 21 | if test "x`make -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then |
michael@0 | 22 | MAKE=gmake |
michael@0 | 23 | else |
michael@0 | 24 | MAKE=make |
michael@0 | 25 | fi |
michael@0 | 26 | fi |
michael@0 | 27 | else |
michael@0 | 28 | MAKE=$GNUMAKE |
michael@0 | 29 | fi |
michael@0 | 30 | |
michael@0 | 31 | if test "x`$MAKE -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then |
michael@0 | 32 | echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2 |
michael@0 | 33 | echo "Please try" >&2 |
michael@0 | 34 | echo >&2 |
michael@0 | 35 | echo " MAKE=<GNU make command name> $0" >&2 |
michael@0 | 36 | echo >&2 |
michael@0 | 37 | echo "or" >&2 |
michael@0 | 38 | echo >&2 |
michael@0 | 39 | echo " MAKE=\"makepp --norc-substitution\" $0" >&2 |
michael@0 | 40 | exit 1 |
michael@0 | 41 | fi |
michael@0 | 42 | |
michael@0 | 43 | # Get `dirname' functionality. This is taken and adapted from autoconf's |
michael@0 | 44 | # m4sh.m4 (_AS_EXPR_PREPARE, AS_DIRNAME_EXPR, and AS_DIRNAME_SED). |
michael@0 | 45 | |
michael@0 | 46 | if expr a : '\(a\)' >/dev/null 2>&1; then |
michael@0 | 47 | ft_expr=expr |
michael@0 | 48 | else |
michael@0 | 49 | ft_expr=false |
michael@0 | 50 | fi |
michael@0 | 51 | |
michael@0 | 52 | ft2_dir=`(dirname "$0") 2>/dev/null || |
michael@0 | 53 | $ft_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ |
michael@0 | 54 | X"$0" : 'X\(//\)[^/]' \| \ |
michael@0 | 55 | X"$0" : 'X\(//\)$' \| \ |
michael@0 | 56 | X"$0" : 'X\(/\)' \| \ |
michael@0 | 57 | . : '\(.\)' 2>/dev/null || |
michael@0 | 58 | echo X"$0" | |
michael@0 | 59 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ |
michael@0 | 60 | s//\1/ |
michael@0 | 61 | q |
michael@0 | 62 | } |
michael@0 | 63 | /^X\(\/\/\)[^/].*/{ |
michael@0 | 64 | s//\1/ |
michael@0 | 65 | q |
michael@0 | 66 | } |
michael@0 | 67 | /^X\(\/\/\)$/{ |
michael@0 | 68 | s//\1/ |
michael@0 | 69 | q |
michael@0 | 70 | } |
michael@0 | 71 | /^X\(\/\).*/{ |
michael@0 | 72 | s//\1/ |
michael@0 | 73 | q |
michael@0 | 74 | } |
michael@0 | 75 | s/.*/./; q'` |
michael@0 | 76 | |
michael@0 | 77 | abs_curr_dir=`pwd` |
michael@0 | 78 | abs_ft2_dir=`cd "$ft2_dir" && pwd` |
michael@0 | 79 | |
michael@0 | 80 | # `--srcdir=' option can override abs_ft2_dir |
michael@0 | 81 | |
michael@0 | 82 | if test $# -gt 0; then |
michael@0 | 83 | for x in "$@"; do |
michael@0 | 84 | case x"$x" in |
michael@0 | 85 | x--srcdir=*) |
michael@0 | 86 | abs_ft2_dir=`echo $x | sed 's/^--srcdir=//'` ;; |
michael@0 | 87 | esac |
michael@0 | 88 | done |
michael@0 | 89 | fi |
michael@0 | 90 | |
michael@0 | 91 | # build a dummy Makefile if we are not building in the source tree; |
michael@0 | 92 | # we use inodes to avoid issues with symbolic links |
michael@0 | 93 | inode_src=`ls -id $abs_ft2_dir | awk '{print $1}'` |
michael@0 | 94 | inode_dst=`ls -id $abs_curr_dir | awk '{print $1}'` |
michael@0 | 95 | |
michael@0 | 96 | if test $inode_src -ne $inode_dst; then |
michael@0 | 97 | if test ! -d reference; then |
michael@0 | 98 | mkdir reference |
michael@0 | 99 | fi |
michael@0 | 100 | if test ! -r $abs_curr_dir/modules.cfg; then |
michael@0 | 101 | echo "Copying \`modules.cfg'" |
michael@0 | 102 | cp $abs_ft2_dir/modules.cfg $abs_curr_dir |
michael@0 | 103 | fi |
michael@0 | 104 | echo "Generating \`Makefile'" |
michael@0 | 105 | echo "TOP_DIR := $abs_ft2_dir" > Makefile |
michael@0 | 106 | echo "OBJ_DIR := $abs_curr_dir" >> Makefile |
michael@0 | 107 | echo "OBJ_BUILD := \$(OBJ_DIR)" >> Makefile |
michael@0 | 108 | echo "DOC_DIR := \$(OBJ_DIR)/reference" >> Makefile |
michael@0 | 109 | echo "FT_LIBTOOL_DIR := \$(OBJ_DIR)" >> Makefile |
michael@0 | 110 | echo "ifndef FT2DEMOS" >> Makefile |
michael@0 | 111 | echo " include \$(TOP_DIR)/Makefile" >> Makefile |
michael@0 | 112 | echo "else" >> Makefile |
michael@0 | 113 | echo " TOP_DIR_2 := \$(TOP_DIR)/../ft2demos" >> Makefile |
michael@0 | 114 | echo " PROJECT := freetype" >> Makefile |
michael@0 | 115 | echo " CONFIG_MK := \$(OBJ_DIR)/config.mk" >> Makefile |
michael@0 | 116 | echo " include \$(TOP_DIR_2)/Makefile" >> Makefile |
michael@0 | 117 | echo "endif" >> Makefile |
michael@0 | 118 | fi |
michael@0 | 119 | |
michael@0 | 120 | # call make |
michael@0 | 121 | |
michael@0 | 122 | CFG= |
michael@0 | 123 | # work around zsh bug which doesn't like `${1+"$@"}' |
michael@0 | 124 | case $# in |
michael@0 | 125 | 0) ;; |
michael@0 | 126 | *) for x in "$@"; do |
michael@0 | 127 | case x"$x" in |
michael@0 | 128 | x--srcdir=* ) CFG="$CFG '$x'/builds/unix" ;; |
michael@0 | 129 | *) CFG="$CFG '$x'" ;; |
michael@0 | 130 | esac |
michael@0 | 131 | done ;; |
michael@0 | 132 | esac |
michael@0 | 133 | CFG=$CFG $MAKE setup unix |
michael@0 | 134 | |
michael@0 | 135 | # eof |