David Turner | dc47784 | 2002-01-08 18:34:11 +0000 | [diff] [blame] | 1 | #!/bin/sh |
David Turner | dc47784 | 2002-01-08 18:34:11 +0000 | [diff] [blame] | 2 | # |
Werner Lemberg | 6f1e345 | 2013-03-21 09:00:27 +0100 | [diff] [blame^] | 3 | # Copyright 2002-2006, 2008-2010, 2013 by |
Werner Lemberg | 60a04df | 2005-06-04 23:04:30 +0000 | [diff] [blame] | 4 | # David Turner, Robert Wilhelm, and Werner Lemberg. |
| 5 | # |
| 6 | # This file is part of the FreeType project, and may only be used, modified, |
| 7 | # and distributed under the terms of the FreeType project license, |
| 8 | # LICENSE.TXT. By continuing to use, modify, or distribute this file you |
| 9 | # indicate that you have read the license and understand and accept it |
| 10 | # fully. |
| 11 | # |
| 12 | # |
Werner Lemberg | 67d546a | 2005-05-24 04:49:42 +0000 | [diff] [blame] | 13 | # Call the `configure' script located in `builds/unix'. |
Werner Lemberg | 3975e2e | 2002-01-09 21:01:18 +0000 | [diff] [blame] | 14 | # |
Werner Lemberg | 67d546a | 2005-05-24 04:49:42 +0000 | [diff] [blame] | 15 | |
| 16 | rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk |
David Turner | d15bc0d | 2002-04-12 09:31:48 +0000 | [diff] [blame] | 17 | |
Werner Lemberg | 6f1e345 | 2013-03-21 09:00:27 +0100 | [diff] [blame^] | 18 | # respect GNUMAKE environment variable for backwards compatibility |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 19 | if test "x$GNUMAKE" = x; then |
Werner Lemberg | 6f1e345 | 2013-03-21 09:00:27 +0100 | [diff] [blame^] | 20 | if test "x$MAKE" = x; then |
| 21 | MAKE=make |
| 22 | fi |
| 23 | else |
| 24 | MAKE=$GNUMAKE |
David Turner | d15bc0d | 2002-04-12 09:31:48 +0000 | [diff] [blame] | 25 | fi |
| 26 | |
Werner Lemberg | 6f1e345 | 2013-03-21 09:00:27 +0100 | [diff] [blame^] | 27 | if test -z "`$MAKE -v 2>/dev/null | grep GNU`"; then |
| 28 | if test -z "`$MAKE -v 2>/dev/null | grep makepp`"; then |
Werner Lemberg | 4e33f9e | 2008-07-05 06:35:28 +0000 | [diff] [blame] | 29 | echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2 |
Werner Lemberg | 26eccb4 | 2004-04-13 08:35:05 +0000 | [diff] [blame] | 30 | echo "Please try" >&2 |
Werner Lemberg | 6f1e345 | 2013-03-21 09:00:27 +0100 | [diff] [blame^] | 31 | echo " \`MAKE=<GNU make command name> $0'." >&2 |
Werner Lemberg | 26eccb4 | 2004-04-13 08:35:05 +0000 | [diff] [blame] | 32 | echo "or >&2" |
Werner Lemberg | 6f1e345 | 2013-03-21 09:00:27 +0100 | [diff] [blame^] | 33 | echo " \`MAKE=\"makepp --norc-substitution\" $0'." >&2 |
Werner Lemberg | 26eccb4 | 2004-04-13 08:35:05 +0000 | [diff] [blame] | 34 | exit 1 |
| 35 | fi |
David Turner | d15bc0d | 2002-04-12 09:31:48 +0000 | [diff] [blame] | 36 | fi |
| 37 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 38 | # Get `dirname' functionality. This is taken and adapted from autoconf's |
| 39 | # m4sh.m4 (_AS_EXPR_PREPARE, AS_DIRNAME_EXPR, and AS_DIRNAME_SED). |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 40 | |
| 41 | if expr a : '\(a\)' >/dev/null 2>&1; then |
| 42 | ft_expr=expr |
| 43 | else |
| 44 | ft_expr=false |
| 45 | fi |
| 46 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 47 | ft2_dir=`(dirname "$0") 2>/dev/null || |
| 48 | $ft_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ |
| 49 | X"$0" : 'X\(//\)[^/]' \| \ |
| 50 | X"$0" : 'X\(//\)$' \| \ |
| 51 | X"$0" : 'X\(/\)' \| \ |
| 52 | . : '\(.\)' 2>/dev/null || |
| 53 | echo X"$0" | |
| 54 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ |
| 55 | s//\1/ |
| 56 | q |
| 57 | } |
| 58 | /^X\(\/\/\)[^/].*/{ |
| 59 | s//\1/ |
| 60 | q |
| 61 | } |
| 62 | /^X\(\/\/\)$/{ |
| 63 | s//\1/ |
| 64 | q |
| 65 | } |
| 66 | /^X\(\/\).*/{ |
| 67 | s//\1/ |
| 68 | q |
| 69 | } |
| 70 | s/.*/./; q'` |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 71 | |
| 72 | abs_curr_dir=`pwd` |
| 73 | abs_ft2_dir=`cd "$ft2_dir" && pwd` |
| 74 | |
Werner Lemberg | b8f97f1 | 2009-06-28 00:37:53 +0200 | [diff] [blame] | 75 | # `--srcdir=' option can override abs_ft2_dir |
suzuki toshiya | 66d308e | 2009-06-27 14:33:06 +0900 | [diff] [blame] | 76 | |
| 77 | if test $# -gt 0; then |
| 78 | for x in "$@"; do |
| 79 | case x"$x" in |
| 80 | x--srcdir=*) |
| 81 | abs_ft2_dir=`echo $x | sed 's/^--srcdir=//'` ;; |
| 82 | esac |
| 83 | done |
| 84 | fi |
| 85 | |
Werner Lemberg | 75eeb32 | 2010-10-03 20:17:27 +0200 | [diff] [blame] | 86 | # build a dummy Makefile if we are not building in the source tree; |
| 87 | # we use inodes to avoid issues with symbolic links |
Werner Lemberg | 94d540e | 2010-10-05 12:28:15 +0200 | [diff] [blame] | 88 | inode_src=`ls -id $abs_ft2_dir | awk '{print $1}'` |
| 89 | inode_dst=`ls -id $abs_curr_dir | awk '{print $1}'` |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 90 | |
Werner Lemberg | 75eeb32 | 2010-10-03 20:17:27 +0200 | [diff] [blame] | 91 | if test $inode_src -ne $inode_dst; then |
| 92 | if test ! -d reference; then |
| 93 | mkdir reference |
| 94 | fi |
suzuki toshiya | 912f039 | 2009-06-27 14:38:32 +0900 | [diff] [blame] | 95 | if test ! -r $abs_curr_dir/modules.cfg; then |
| 96 | echo "Copying \`modules.cfg'" |
| 97 | cp $abs_ft2_dir/modules.cfg $abs_curr_dir |
| 98 | fi |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 99 | echo "Generating \`Makefile'" |
Werner Lemberg | 8a6808e | 2011-12-02 20:22:04 +0100 | [diff] [blame] | 100 | echo "TOP_DIR := $abs_ft2_dir" > Makefile |
| 101 | echo "OBJ_DIR := $abs_curr_dir" >> Makefile |
| 102 | echo "OBJ_BUILD := \$(OBJ_DIR)" >> Makefile |
| 103 | echo "DOC_DIR := \$(OBJ_DIR)/reference" >> Makefile |
| 104 | echo "FT_LIBTOOL_DIR := \$(OBJ_DIR)" >> Makefile |
| 105 | echo "ifndef FT2DEMOS" >> Makefile |
| 106 | echo " include \$(TOP_DIR)/Makefile" >> Makefile |
| 107 | echo "else" >> Makefile |
| 108 | echo " TOP_DIR_2 := \$(TOP_DIR)/../ft2demos" >> Makefile |
| 109 | echo " PROJECT := freetype" >> Makefile |
| 110 | echo " CONFIG_MK := \$(OBJ_DIR)/config.mk" >> Makefile |
| 111 | echo " include \$(TOP_DIR_2)/Makefile" >> Makefile |
| 112 | echo "endif" >> Makefile |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 113 | fi |
| 114 | |
| 115 | # call make |
| 116 | |
Werner Lemberg | d898aed | 2006-08-29 09:50:34 +0000 | [diff] [blame] | 117 | CFG= |
Werner Lemberg | 4e33f9e | 2008-07-05 06:35:28 +0000 | [diff] [blame] | 118 | # work around zsh bug which doesn't like `${1+"$@"}' |
| 119 | case $# in |
| 120 | 0) ;; |
| 121 | *) for x in "$@"; do |
suzuki toshiya | 66d308e | 2009-06-27 14:33:06 +0900 | [diff] [blame] | 122 | case x"$x" in |
| 123 | x--srcdir=* ) CFG="$CFG '$x'/builds/unix" ;; |
| 124 | *) CFG="$CFG '$x'" ;; |
| 125 | esac |
Werner Lemberg | 4e33f9e | 2008-07-05 06:35:28 +0000 | [diff] [blame] | 126 | done ;; |
| 127 | esac |
Werner Lemberg | 6f1e345 | 2013-03-21 09:00:27 +0100 | [diff] [blame^] | 128 | CFG=$CFG $MAKE setup unix |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 129 | |
| 130 | # eof |