Browse Source

improve configure script

Syping 6 months ago
parent
commit
c909e20178
2 changed files with 89 additions and 6 deletions
  1. 1
    0
      ProfileInterface.cpp
  2. 88
    6
      configure

+ 1
- 0
ProfileInterface.cpp View File

@@ -64,6 +64,7 @@
64 64
 #include <QDir>
65 65
 
66 66
 #include <random>
67
+#include <ctime>
67 68
 
68 69
 #define importTimeFormat "HHmmss"
69 70
 #define findRetryLimit 500

+ 88
- 6
configure View File

@@ -1,4 +1,4 @@
1
-#!/bin/bash
1
+#!/usr/bin/env bash
2 2
 #*****************************************************************************
3 3
 # gta5view Grand Theft Auto V Profile Viewer
4 4
 # Copyright (C) 2018 Syping
@@ -35,10 +35,15 @@ begins_with_short_option()
35 35
 }
36 36
 _arg_prefix=
37 37
 _arg_qmake=
38
+_arg_telemetry_authid=
39
+_arg_telemetry_authpw=
40
+_arg_telemetry_pushurl=
41
+_arg_telemetry_regurl=
42
+_arg_telemetry_weburl=
38 43
 print_help ()
39 44
 {
40 45
    printf '%s\n' "gta5view Configure Script"
41
-   printf 'Usage: %s [--prefix <arg>] [--qmake <arg>] [-h|--help]\n' "$0"
46
+   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"
42 47
    printf '\t%s\n' "-h,--help: Prints help"
43 48
 }
44 49
 parse_commandline ()
@@ -63,6 +68,46 @@ parse_commandline ()
63 68
          --qmake=*)
64 69
             _arg_qmake="${_key##--qmake=}"
65 70
             ;;
71
+         --telemetry-authid)
72
+            test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
73
+            _arg_telemetry_authid="$2"
74
+            shift
75
+            ;;
76
+         --telemetry-authid=*)
77
+            _arg_telemetry_authid="${_key##--telemetry-authid=}"
78
+            ;;
79
+         --telemetry-authpw)
80
+            test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
81
+            _arg_telemetry_authpw="$2"
82
+            shift
83
+            ;;
84
+         --telemetry-authpw=*)
85
+            _arg_telemetry_authpw="${_key##--telemetry-authpw=}"
86
+            ;;
87
+         --telemetry-pushurl)
88
+            test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
89
+            _arg_telemetry_pushurl="$2"
90
+            shift
91
+            ;;
92
+         --telemetry-pushurl=*)
93
+            _arg_telemetry_pushurl="${_key##--telemetry-pushurl=}"
94
+            ;;
95
+         --telemetry-regurl)
96
+            test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
97
+            _arg_telemetry_regurl="$2"
98
+            shift
99
+            ;;
100
+         --telemetry-regurl=*)
101
+            _arg_telemetry_regurl="${_key##--telemetry-regurl=}"
102
+            ;;
103
+         --telemetry-weburl)
104
+            test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
105
+            _arg_telemetry_weburl="$2"
106
+            shift
107
+            ;;
108
+         --telemetry-weburl=*)
109
+            _arg_telemetry_weburl="${_key##--telemetry-weburl=}"
110
+            ;;
66 111
          -h|--help)
67 112
             print_help
68 113
             exit 0
@@ -81,12 +126,24 @@ parse_commandline ()
81 126
 parse_commandline "$@"
82 127
 
83 128
 # Initialise bash script - Step 1
84
-if [ ! "${_arg_prefix}" == "" ]; then
129
+if [ "${_arg_prefix}" != "" ]; then
85 130
   PREFIX=${_arg_prefix}
86 131
 fi
87
-if [ ! "${_arg_qmake}" == "" ]; then
132
+if [ "${_arg_qmake}" != "" ]; then
88 133
   QMAKE_PATH=${_arg_qmake}
89 134
 fi
135
+if [ "${_arg_telemetry_authid}" != "" ] && [ "${_arg_telemetry_authpw}" != "" ] && [ "${_arg_telemetry_pushurl}" != "" ] && [ "${_arg_telemetry_regurl}" != "" ]; then
136
+   _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY"
137
+   _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_AUTHID=\\\\\\\"${_arg_telemetry_authid}\\\\\\\""
138
+   _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_AUTHPW=\\\\\\\"${_arg_telemetry_authpw}\\\\\\\""
139
+   _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_PUSHURL=\\\\\\\"${_arg_telemetry_pushurl}\\\\\\\""
140
+   _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_REGURL=\\\\\\\"${_arg_telemetry_regurl}\\\\\\\""
141
+   if [ "${_arg_telemetry_weburl}" != "" ]; then
142
+      _telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"${_arg_telemetry_weburl}\\\\\\\""
143
+   fi
144
+else
145
+   _telemetry_args=
146
+fi
90 147
 
91 148
 # Initialise bash script - Step 2
92 149
 set +e
@@ -136,18 +193,43 @@ else
136 193
 fi
137 194
 
138 195
 # Clean Makefile
139
-if [ ! "${RUN_MAKE_CLEAN}" == "NO" ]; then
196
+if [ "${RUN_MAKE_CLEAN}" != "NO" ]; then
140 197
    if [ -f "Makefile" ]; then
141 198
       echo "${MAKE_PATH} distclean"
142 199
       ${MAKE_PATH} distclean
143 200
    fi
144 201
 fi
145 202
 
203
+# Set qConf
204
+if [ "${NO_QCONF}" != "YES" ]; then
205
+   _extra_args="${_extra_args} DEFINES+=GTA5SYNC_QCONF"
206
+fi
207
+
146 208
 # Set Prefix
147
-if [ ! "${PREFIX}" == "" ]; then
209
+if [ "${PREFIX}" != "" ]; then
148 210
    _extra_args="${_extra_args} GTA5SYNC_PREFIX=${PREFIX}"
149 211
 fi
150 212
 
213
+# Set Build Type
214
+if [ "${BUILDTYPE}" == "Alpha" ]; then
215
+   _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_ALPHA"
216
+elif [ "${BUILDTYPE}" == "Beta" ]; then
217
+   _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_BETA"
218
+elif [ "${BUILDTYPE}" == "Developer" ]; then
219
+   _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_DEV"
220
+elif [ "${BUILDTYPE}" == "Daily Build" ]; then
221
+   _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_DAILY"
222
+elif [ "${BUILDTYPE}" == "Release Candidate" ]; then
223
+   _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_RC"
224
+elif [ "${BUILDTYPE}" == "Release" ]; then
225
+   _extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_REL"
226
+fi
227
+
228
+# Add Telemetry Args
229
+if [ "${_telemetry_args}" != "" ]; then
230
+   _extra_args="${_extra_args}${_telemetry_args}"
231
+fi
232
+
151 233
 # Generating Makefile
152 234
 echo "${QMAKE_PATH}${_extra_args} ${SOURCE_DIR}/gta5view.pro"
153 235
 ${QMAKE_PATH}${_extra_args} ${SOURCE_DIR}/gta5view.pro