🛠️🐜 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.

193 lines
4.5 KiB

  1. #!/bin/sh
  2. # Copyright (C) 2005-2021 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. if test ! -f ./builds/unix/configure.raw; then
  101. echo "You must be in the same directory as \`autogen.sh'."
  102. echo "Bootstrapping doesn't work if srcdir != builddir."
  103. exit 1
  104. fi
  105. # On MacOS X, the GNU libtool is named `glibtool'.
  106. HOSTOS=`uname`
  107. if test "$LIBTOOLIZE"x != x; then
  108. :
  109. elif test "$HOSTOS"x = Darwinx; then
  110. LIBTOOLIZE=glibtoolize
  111. else
  112. LIBTOOLIZE=libtoolize
  113. fi
  114. if test "$ACLOCAL"x = x; then
  115. ACLOCAL=aclocal
  116. fi
  117. if test "$AUTOCONF"x = x; then
  118. AUTOCONF=autoconf
  119. fi
  120. check_tool_version $ACLOCAL aclocal ACLOCAL 1.10.1
  121. check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
  122. check_tool_version $AUTOCONF autoconf AUTOCONF 2.62
  123. # This sets FREETYPE version.
  124. eval `sed -n \
  125. -e 's/^#define *\(FREETYPE_MAJOR\) *\([0-9][0-9]*\).*/\1=\2/p' \
  126. -e 's/^#define *\(FREETYPE_MINOR\) *\([0-9][0-9]*\).*/\1=\2/p' \
  127. -e 's/^#define *\(FREETYPE_PATCH\) *\([0-9][0-9]*\).*/\1=\2/p' \
  128. include/freetype/freetype.h`
  129. if test "$FREETYPE_PATCH" = "0"; then
  130. FREETYPE=$FREETYPE_MAJOR.$FREETYPE_MINOR
  131. else
  132. FREETYPE=$FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH
  133. fi
  134. echo "FreeType $FREETYPE:"
  135. cd builds/unix
  136. echo "generating \`configure.ac'"
  137. sed -e "s;@VERSION@;$FREETYPE;" \
  138. < configure.raw > configure.ac
  139. run aclocal -I . --force
  140. run $LIBTOOLIZE --force --copy --install
  141. run autoconf --force
  142. chmod +x install-sh
  143. cd ../..
  144. chmod +x ./configure
  145. # Copy all necessary 'dlg' files.
  146. copy_submodule_files ()
  147. {
  148. echo "Copying files from \`subprojects/dlg' to \`src/dlg' and \`include/dlg'"
  149. mkdir include/dlg 2> /dev/null
  150. cp $DLG_INC_DIR/output.h include/dlg
  151. cp $DLG_INC_DIR/dlg.h include/dlg
  152. cp $DLG_SRC_DIR/* src/dlg
  153. }
  154. DLG_INC_DIR=subprojects/dlg/include/dlg
  155. DLG_SRC_DIR=subprojects/dlg/src/dlg
  156. if ! test -d "$DLG_INC_DIR"; then
  157. echo "Checking out submodule in \`subprojects/dlg':"
  158. git submodule init
  159. git submodule update
  160. fi
  161. copy_submodule_files
  162. # EOF