🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
4.7 KiB

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