Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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