Open Source Snapmatic picture and Savegame viewer/editor for GTA V https://gta5view.syping.de/

configure 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. #!/usr/bin/env bash
  2. #*****************************************************************************
  3. # gta5view Grand Theft Auto V Profile Viewer
  4. # Copyright (C) 2018 Syping
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #*****************************************************************************
  19. # Argbash generated code
  20. die()
  21. {
  22. local _ret=$2
  23. test -n "$_ret" || _ret=1
  24. test "$_PRINT_HELP" = yes && print_help >&2
  25. echo "$1" >&2
  26. exit ${_ret}
  27. }
  28. begins_with_short_option()
  29. {
  30. local first_option all_short_options
  31. all_short_options='h'
  32. first_option="${1:0:1}"
  33. test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
  34. }
  35. _arg_prefix=
  36. _arg_qmake=
  37. _arg_telemetry_authid=
  38. _arg_telemetry_authpw=
  39. _arg_telemetry_pushurl=
  40. _arg_telemetry_regurl=
  41. _arg_telemetry_weburl=
  42. print_help ()
  43. {
  44. printf '%s\n' "gta5view Configure Script"
  45. printf 'Usage: %s [--prefix <arg>] [--qmake <arg>] [--telemetry-authid <arg>] [--telemetry-authpw <arg>] [--telemetry-pushurl <arg>] [--telemetry-regurl <arg>] [--telemetry-weburl <arg>] [-h|--help]\n' "$0"
  46. printf '\t%s\n' "-h,--help: Prints help"
  47. }
  48. parse_commandline ()
  49. {
  50. while test $# -gt 0
  51. do
  52. _key="$1"
  53. case "$_key" in
  54. --prefix)
  55. test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  56. _arg_prefix="$2"
  57. shift
  58. ;;
  59. --prefix=*)
  60. _arg_prefix="${_key##--prefix=}"
  61. ;;
  62. --qmake)
  63. test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  64. _arg_qmake="$2"
  65. shift
  66. ;;
  67. --qmake=*)
  68. _arg_qmake="${_key##--qmake=}"
  69. ;;
  70. --telemetry-authid)
  71. test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  72. _arg_telemetry_authid="$2"
  73. shift
  74. ;;
  75. --telemetry-authid=*)
  76. _arg_telemetry_authid="${_key##--telemetry-authid=}"
  77. ;;
  78. --telemetry-authpw)
  79. test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  80. _arg_telemetry_authpw="$2"
  81. shift
  82. ;;
  83. --telemetry-authpw=*)
  84. _arg_telemetry_authpw="${_key##--telemetry-authpw=}"
  85. ;;
  86. --telemetry-pushurl)
  87. test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  88. _arg_telemetry_pushurl="$2"
  89. shift
  90. ;;
  91. --telemetry-pushurl=*)
  92. _arg_telemetry_pushurl="${_key##--telemetry-pushurl=}"
  93. ;;
  94. --telemetry-regurl)
  95. test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  96. _arg_telemetry_regurl="$2"
  97. shift
  98. ;;
  99. --telemetry-regurl=*)
  100. _arg_telemetry_regurl="${_key##--telemetry-regurl=}"
  101. ;;
  102. --telemetry-weburl)
  103. test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
  104. _arg_telemetry_weburl="$2"
  105. shift
  106. ;;
  107. --telemetry-weburl=*)
  108. _arg_telemetry_weburl="${_key##--telemetry-weburl=}"
  109. ;;
  110. -h|--help)
  111. print_help
  112. exit 0
  113. ;;
  114. -h*)
  115. print_help
  116. exit 0
  117. ;;
  118. *)
  119. _PRINT_HELP=yes die "FATAL ERROR: Got an unexpected argument '$1'" 1
  120. ;;
  121. esac
  122. shift
  123. done
  124. }
  125. parse_commandline "$@"
  126. # Initialise bash script - Step 1
  127. if [ "${_arg_prefix}" != "" ]; then
  128. PREFIX=${_arg_prefix}
  129. fi
  130. if [ "${_arg_qmake}" != "" ]; then
  131. QMAKE_PATH=${_arg_qmake}
  132. fi
  133. if [ "${_arg_telemetry_authid}" != "" ] && [ "${_arg_telemetry_authpw}" != "" ] && [ "${_arg_telemetry_pushurl}" != "" ] && [ "${_arg_telemetry_regurl}" != "" ]; then
  134. _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY"
  135. _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_AUTHID=\\\\\\\"${_arg_telemetry_authid}\\\\\\\""
  136. _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_AUTHPW=\\\\\\\"${_arg_telemetry_authpw}\\\\\\\""
  137. _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_PUSHURL=\\\\\\\"${_arg_telemetry_pushurl}\\\\\\\""
  138. _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_REGURL=\\\\\\\"${_arg_telemetry_regurl}\\\\\\\""
  139. if [ "${_arg_telemetry_weburl}" != "" ]; then
  140. _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"${_arg_telemetry_weburl}\\\\\\\""
  141. fi
  142. else
  143. _telemetry_args=
  144. fi
  145. # Initialise bash script - Step 2
  146. set +e
  147. _extra_args=
  148. # Find Source Directory
  149. SOURCE=${BASH_SOURCE[0]}
  150. while [ -h "$SOURCE" ]; do
  151. SOURCE_DIR=$(cd -P "$(dirname "$SOURCE")" && pwd)
  152. SOURCE=$(readlink "$SOURCE")
  153. [[ $SOURCE != /* ]] && SOURCE="${SOURCE_DIR}/${SOURCE}"
  154. done
  155. SOURCE_DIR=$(cd -P "$(dirname "$SOURCE")" && pwd)
  156. # Find Qt Installation
  157. export QT_SELECT=qt5
  158. if [ -x "${QMAKE_PATH}" ]; then
  159. QMAKE_PATH=${QMAKE_PATH}
  160. QT_VERSION=$(${QMAKE_PATH} -query "QT_VERSION")
  161. elif [ -x "$(command -v qmake-qt5)" ]; then
  162. QMAKE_PATH=$(command -v qmake-qt5)
  163. QT_VERSION=$(${QMAKE_PATH} -query "QT_VERSION")
  164. elif [ -x "$(command -v qmake)" ]; then
  165. QMAKE_PATH=$(command -v qmake)
  166. QT_VERSION=$(${QMAKE_PATH} -query "QT_VERSION")
  167. else
  168. QMAKE_PATH=$(find /usr/ -executable -name qmake -type f 2> /dev/null | sed -n 1p)
  169. if [ "${QMAKE_PATH}" == "" ]; then
  170. echo "Qt qmake not found"
  171. exit 1
  172. fi
  173. QT_VERSION=$(${QMAKE_PATH} -query "QT_VERSION")
  174. fi
  175. echo "Found Qt ${QT_VERSION} with qmake located at ${QMAKE_PATH}"
  176. # Find Make Installation
  177. if [ -x "${MAKE_PATH}" ]; then
  178. MAKE_PATH=${MAKE_PATH}
  179. elif [ -x "$(command -v make)" ]; then
  180. MAKE_PATH=$(command -v make)
  181. else
  182. MAKE_PATH=$(find /usr/ -executable -name make -type f 2> /dev/null | sed -n 1p)
  183. if [ "${MAKE_PATH}" == "" ]; then
  184. echo "Make not found"
  185. exit 1
  186. fi
  187. fi
  188. # Clean Makefile
  189. if [ "${RUN_MAKE_CLEAN}" != "NO" ]; then
  190. if [ -f "Makefile" ]; then
  191. echo "${MAKE_PATH} distclean"
  192. ${MAKE_PATH} distclean
  193. fi
  194. fi
  195. # Set qConf
  196. if [ "${NO_QCONF}" != "YES" ]; then
  197. _extra_args="${_extra_args} DEFINES+=GTA5SYNC_QCONF"
  198. fi
  199. # Set Prefix
  200. if [ "${PREFIX}" != "" ]; then
  201. _extra_args="${_extra_args} GTA5SYNC_PREFIX=${PREFIX}"
  202. fi
  203. # Set Build Type
  204. if [ "${BUILDTYPE}" == "Alpha" ]; then
  205. _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_ALPHA"
  206. elif [ "${BUILDTYPE}" == "Beta" ]; then
  207. _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_BETA"
  208. elif [ "${BUILDTYPE}" == "Developer" ]; then
  209. _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_DEV"
  210. elif [ "${BUILDTYPE}" == "Daily Build" ]; then
  211. _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_DAILY"
  212. elif [ "${BUILDTYPE}" == "Release Candidate" ]; then
  213. _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_RC"
  214. elif [ "${BUILDTYPE}" == "Release" ]; then
  215. _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_REL"
  216. fi
  217. # Add Telemetry Args
  218. if [ "${_telemetry_args}" != "" ]; then
  219. _extra_args="${_extra_args}${_telemetry_args}"
  220. fi
  221. # Generating Makefile
  222. echo "${QMAKE_PATH}${_extra_args} ${SOURCE_DIR}/gta5view.pro"
  223. ${QMAKE_PATH}${_extra_args} ${SOURCE_DIR}/gta5view.pro
  224. # Make dependencies
  225. if [ "${RUN_MAKE_DEPEND}" == "YES" ]; then
  226. echo "${MAKE_PATH} depend"
  227. ${MAKE_PATH} depend
  228. fi
  229. exit 0