diff --git a/Autobuild.sh b/Autobuild.sh index 2e19e01623..c060f1bf8f 100755 --- a/Autobuild.sh +++ b/Autobuild.sh @@ -26,6 +26,7 @@ do ;; v) VERSION="$OPTARG" + VERSIONARGS="--version=$OPTARG" ;; esac done diff --git a/Autobuild/android.sh b/Autobuild/android.sh index 4a43fbb3fa..71cd8ae463 100644 --- a/Autobuild/android.sh +++ b/Autobuild/android.sh @@ -9,6 +9,7 @@ fi ./configure.android --build=${TARGET} \ ${RELEASE} \ + ${VERSIONARGS} \ --cleanbuild \ ${USE_CCACHE} \ --downloadcache="${WORKINGDIR}/downloadcache" \ diff --git a/Autobuild/debian.sh b/Autobuild/debian.sh index f0515ef0ff..95ea36d720 100755 --- a/Autobuild/debian.sh +++ b/Autobuild/debian.sh @@ -11,6 +11,7 @@ echo >>${CHANGELOG} " -- Andreas Öman ${NOW}" export JARGS export ARCH +export VERSIONARGS if ccache=$(which ccache); then echo "Using ccache" diff --git a/Autobuild/osx.sh b/Autobuild/osx.sh index 3339036940..c0e5da3274 100644 --- a/Autobuild/osx.sh +++ b/Autobuild/osx.sh @@ -12,6 +12,7 @@ set -e set -x ./configure.osx ${RELEASE} --cleanbuild ${USE_CCACHE} \ + ${VERSIONARGS} \ --downloadcache="${WORKINGDIR}/downloadcache" set +x diff --git a/Autobuild/ps3.sh b/Autobuild/ps3.sh index 48c6d45ca1..70ee209d13 100644 --- a/Autobuild/ps3.sh +++ b/Autobuild/ps3.sh @@ -49,6 +49,7 @@ fi ./configure.ps3 --build=${TARGET} \ ${RELEASE} \ + ${VERSIONARGS} \ --cleanbuild \ ${USE_CCACHE} \ --downloadcache="${WORKINGDIR}/downloadcache" diff --git a/Autobuild/rpi.sh b/Autobuild/rpi.sh index 954cd3295a..c627ac23ef 100644 --- a/Autobuild/rpi.sh +++ b/Autobuild/rpi.sh @@ -50,6 +50,7 @@ set -x ./configure.rpi --build=${TARGET} \ --toolchain="${TOOLCHAIN}/host/usr/bin/arm-buildroot-linux-gnueabihf-" \ --sysroot="${TOOLCHAIN}/host/usr/arm-buildroot-linux-gnueabihf/sysroot" \ + ${VERSIONARGS} \ ${RELEASE} \ --cleanbuild \ ${USE_CCACHE} \ diff --git a/debian/rules b/debian/rules index 96c56c10c5..1a00fc364d 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,7 @@ export DH_VERBOSE=1 dh $@ override_dh_auto_configure: - dh_auto_configure -- --release ${USE_CCACHE} ${ARCH} + dh_auto_configure -- --release ${USE_CCACHE} ${ARCH} ${VERSIONARGS} override_dh_installdocs: @echo No documentation diff --git a/ios/Movian/AppDelegate.m b/ios/Movian/AppDelegate.m index dc239d378e..ad27e61814 100644 --- a/ios/Movian/AppDelegate.m +++ b/ios/Movian/AppDelegate.m @@ -21,8 +21,7 @@ @import MediaPlayer; -const char *htsversion; -const char *htsversion_full; +const char *appversion; uint32_t parse_version_int(const char *str) @@ -31,17 +30,17 @@ int minor = 0; int commit = 0; sscanf(str, "%d.%d.%d", &major, &minor, &commit); - + return - major * 10000000 + - minor * 100000 + - commit; + major * 10000000 + + minor * 100000 + + commit; } uint32_t app_get_version_int(void) { - return parse_version_int(htsversion); + return parse_version_int(appversion); } @@ -224,8 +223,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary]; NSString* version = [infoDict objectForKey:@"CFBundleShortVersionString"]; - htsversion_full = htsversion = strdup([version UTF8String]); - + appversion = strdup([version UTF8String]); + gconf.concurrency = (int)[[NSProcessInfo processInfo] activeProcessorCount]; #ifdef TARGET_OS_TV diff --git a/src/api/httpcontrol.c b/src/api/httpcontrol.c index 333fe355ac..2764b7a9c0 100644 --- a/src/api/httpcontrol.c +++ b/src/api/httpcontrol.c @@ -118,7 +118,7 @@ hc_root_old(http_connection_t *hc) "" "

%s

Version %s" , gconf.system_name, - htsversion_full); + appversion); htsbuf_qprintf(&out, "

" @@ -343,13 +343,12 @@ hc_diagnostics(http_connection_t *hc, const char *remain, void *opaque, { htsbuf_queue_t out; htsbuf_queue_init(&out, 0); - extern const char *htsversion_full; - htsbuf_qprintf(&out, + htsbuf_qprintf(&out, "" "%s Version %s

" , gconf.system_name, - htsversion_full); + appversion); diag_html(hc, &out); diff --git a/src/arch/linux/linux_trap.c b/src/arch/linux/linux_trap.c index 7f8dd22bbd..a937909294 100644 --- a/src/arch/linux/linux_trap.c +++ b/src/arch/linux/linux_trap.c @@ -366,7 +366,7 @@ linux_trap_init(void) self[r] = 0; snprintf(line1, sizeof(line1), - "PRG: "APPNAMEUSER" (%s) EXE: %s, CWD: %s ", htsversion_full, + "PRG: "APPNAMEUSER" (%s) EXE: %s, CWD: %s ", appversion, self, getcwd(path, sizeof(path))); dl_iterate_phdr(callback, NULL); diff --git a/src/backend/bittorrent/peer.c b/src/backend/bittorrent/peer.c index 474f610aa1..8287a13dd0 100644 --- a/src/backend/bittorrent/peer.c +++ b/src/backend/bittorrent/peer.c @@ -1540,7 +1540,7 @@ peer_send_extension_handshake(peer_t *p) htsmsg_add_u32(m, "ut_metadata", EXTENSION_MSGID_METADATA); htsmsg_add_msg(handshake, "m", m); - snprintf(version, sizeof(version), APPNAMEUSER" %s", htsversion); + snprintf(version, sizeof(version), APPNAMEUSER" %s", appversion); htsmsg_add_str(handshake, "v", version); peer_send_extension_msg(p, handshake, EXTENSION_MSGID_HANDSHAKE); } diff --git a/src/ecmascript/ecmascript.c b/src/ecmascript/ecmascript.c index baca60aab5..eb08550366 100644 --- a/src/ecmascript/ecmascript.c +++ b/src/ecmascript/ecmascript.c @@ -478,7 +478,7 @@ es_create_env(es_context_t *ec, const char *loaddir, const char *storage) duk_push_int(ctx, app_get_version_int()); duk_put_prop_string(ctx, obj_idx, "currentVersionInt"); - duk_push_string(ctx, htsversion); + duk_push_string(ctx, appversion); duk_put_prop_string(ctx, obj_idx, "currentVersionString"); duk_push_string(ctx, gconf.device_id); diff --git a/src/fileaccess/fa_http.c b/src/fileaccess/fa_http.c index 0c37e98038..b86d780119 100644 --- a/src/fileaccess/fa_http.c +++ b/src/fileaccess/fa_http.c @@ -971,7 +971,7 @@ http_headers_init(struct http_header_list *l, const http_file_t *hf) http_header_add(l, "Connection", hf->hf_want_close ? "close" : "keep-alive", 0); snprintf(str, sizeof(str), APPNAMEUSER" %s %s", - arch_get_system_type(), htsversion); + arch_get_system_type(), appversion); http_header_add(l, "User-Agent", str, 0); } diff --git a/src/main.c b/src/main.c index a8aed61df1..9c4cabb88e 100644 --- a/src/main.c +++ b/src/main.c @@ -145,12 +145,10 @@ static void init_global_info(void) { prop_t *s = prop_create(prop_get_global(), "app"); - extern const char *htsversion; - extern const char *htsversion_full; prop_set(s, "name", PROP_SET_STRING, APPNAMEUSER); - prop_set(s, "version", PROP_SET_STRING, htsversion); - prop_set(s, "fullversion", PROP_SET_STRING, htsversion_full); + prop_set(s, "version", PROP_SET_STRING, appversion); + prop_set(s, "fullversion", PROP_SET_STRING, appversion); prop_set(s, "copyright", PROP_SET_STRING, "© 2006 - 2016 Lonelycoder AB"); } @@ -538,7 +536,7 @@ parse_opts(int argc, char **argv) " URL is any URL-type supported, " "e.g., \"file:///...\"\n" "\n", - htsversion_full, + appversion, argv0, gconf.cache_path, gconf.persistent_path); diff --git a/src/main.h b/src/main.h index 49c32c3d06..67110187f9 100644 --- a/src/main.h +++ b/src/main.h @@ -341,8 +341,7 @@ typedef struct gconf { extern gconf_t gconf; /* From version.c */ -extern const char *htsversion; -extern const char *htsversion_full; +extern const char *appversion; typedef struct inithelper { LIST_ENTRY(inithelper) link; diff --git a/src/networking/ftp_server.c b/src/networking/ftp_server.c index 48e964e16d..c9740ca732 100644 --- a/src/networking/ftp_server.c +++ b/src/networking/ftp_server.c @@ -256,7 +256,7 @@ static int cmd_SYST(ftp_connection_t *fc, char *args) { ftp_write(fc, 215, "UNIX Type: L8 Version: %s %s", - htsversion, arch_get_system_type()); + appversion, arch_get_system_type()); return 0; } @@ -868,7 +868,7 @@ ftp_session(void *aux) net_fmt_host(buf, sizeof(buf), &fc->fc_local_addr); ftp_write(fc, 220, "%s FTP server (%s Version %s) ready.", - buf, gconf.system_name, htsversion); + buf, gconf.system_name, appversion); while(1) { if(tcp_read_line(fc->fc_tc, buf, sizeof(buf))) diff --git a/src/networking/http_server.c b/src/networking/http_server.c index 3fd2970f27..13086dae4d 100644 --- a/src/networking/http_server.c +++ b/src/networking/http_server.c @@ -366,7 +366,7 @@ http_send_header(http_connection_t *hc, int rc, const char *content, rc, http_rc2str(rc)); htsbuf_qprintf(&hdrs, "Server: "APPNAMEUSER" %s\r\n", - htsversion_full); + appversion); htsbuf_qprintf(&hdrs, "Date: %s\r\n", http_asctime(t, date, sizeof(date))); diff --git a/src/networking/ssdp.c b/src/networking/ssdp.c index ee3100f027..8577a9b1c1 100644 --- a/src/networking/ssdp.c +++ b/src/networking/ssdp.c @@ -178,7 +178,7 @@ ssdp_send(asyncio_fd_t *af, const net_addr_t *myaddr, const net_addr_t *dst, dst ? "HTTP/1.1 200 OK" : "NOTIFY * HTTP/1.1", ssdp_uuid, usn_postfix ?: "", incl_host ? "HOST: 239.255.255.250:1900\r\n" : "", - htsversion, htsversion, + appversion, appversion, *date ? "DATE: " : "", date, *date ? "\r\n" : "", dst ? "EXT:\r\n" : "", myaddr->na_addr[0], diff --git a/src/trace.c b/src/trace.c index a4790d1c53..81f1623902 100644 --- a/src/trace.c +++ b/src/trace.c @@ -339,11 +339,10 @@ trace_init(void) log_root = prop_create(prop_get_global(), "logbuffer"); hts_mutex_init(&trace_mutex); trace_initialized = 1; - extern const char *htsversion_full; TRACE(TRACE_INFO, "SYSTEM", APPNAMEUSER" %s starting. %d CPU cores. Systemtype:%s OS:%s", - htsversion_full, gconf.concurrency, + appversion, gconf.concurrency, arch_get_system_type(), gconf.os_info[0] ? gconf.os_info : ""); } diff --git a/src/ui/gu/gu_menubar.c b/src/ui/gu/gu_menubar.c index 98af6e5079..1a24902e95 100644 --- a/src/ui/gu/gu_menubar.c +++ b/src/ui/gu/gu_menubar.c @@ -55,10 +55,10 @@ m_about(GtkWidget *menu_item, gpointer callback_data) gu_window_t *gw = callback_data; gtk_show_about_dialog(GTK_WINDOW(gw->gw_window), - "program-name", "HTS Showtime", - "version", htsversion, - "website", "http://www.lonelycoder.com/hts", - "copyright", "2006 - 2009 Andreas Öman, et al.", + "program-name", APPNAMEUSER, + "version", appversion, + "website", "https://movian.tv/", + "copyright", "Lonelycoder AB", NULL); } diff --git a/src/upnp/upnp.c b/src/upnp/upnp.c index a2538c26ce..a0ab066c6c 100644 --- a/src/upnp/upnp.c +++ b/src/upnp/upnp.c @@ -153,7 +153,7 @@ send_dev_description(http_connection_t *hc, const char *remain, void *opaque, "/" "", gconf.system_name, - htsversion_full, + appversion, upnp_uuid); diff --git a/src/usage.c b/src/usage.c index 152ceeba4e..8f7ff5e3a1 100644 --- a/src/usage.c +++ b/src/usage.c @@ -119,7 +119,6 @@ try_send(void *aux) htsmsg_add_u32(m, "begin_session", 1); htsmsg_t *metrics = htsmsg_create_map(); - extern const char *htsversion_full; htsmsg_add_str(metrics, "_os", arch_get_system_type()); @@ -135,7 +134,7 @@ try_send(void *aux) else htsmsg_add_str(metrics, "_carrier", "none"); - htsmsg_add_str(metrics, "_app_version", htsversion_full); + htsmsg_add_str(metrics, "_app_version", appversion); htsmsg_add_str(metrics, "_locale", gconf.lang); htsmsg_add_msg(m, "metrics", metrics); diff --git a/src/version.c b/src/version.c index 3b466003c9..1fae20ac8a 100644 --- a/src/version.c +++ b/src/version.c @@ -20,8 +20,11 @@ #include "buildversion.h" #include "config.h" -const char *htsversion=BUILD_VERSION; -const char *htsversion_full=BUILD_VERSION; +#ifdef VERSIONOVERRIDE +const char *appversion=VERSIONOVERRIDE; +#else +const char *appversion=BUILD_VERSION; +#endif #include "main.h" #include @@ -35,14 +38,14 @@ parse_version_int(const char *str) sscanf(str, "%d.%d.%d", &major, &minor, &commit); return - major * 10000000 + + major * 10000000 + minor * 100000 + commit; } uint32_t -app_get_version_int(void) +app_get_version_int(void) { - return parse_version_int(BUILD_VERSION); + return parse_version_int(appversion); } diff --git a/support/configure.inc b/support/configure.inc index 065f6f2a83..bb0b732ccf 100644 --- a/support/configure.inc +++ b/support/configure.inc @@ -220,6 +220,7 @@ common_help(){ echo "Standard options:" echo " --help Print this message" echo " --build=BUILD Build in build.BUILD [build.$BUILD]" + echo " --version=VERSION Override version from git-describe" echo " --release Stage for release" echo " --cleanbuild Erase builddir before configuring" echo " --ccache Enable use of ccache" @@ -240,6 +241,8 @@ common_opt(){ --build=*) BUILD="$2" ;; + --version=*) VERSIONOVERRIDE="$2" + ;; --extra-cflags=*) EXTRA_CFLAGS="$2" ;; --extra-ldflags=*) EXTRA_LDFLAGS="$2" @@ -353,6 +356,13 @@ EOF #define SHOWTIME_DEFAULT_LOGTARGET "${DEFAULT_LOGTARGET}" EOF +# +# Version override +# +if [ -n "$VERSIONOVERRIDE" ]; then + echo >>${CONFIG_H} "#define VERSIONOVERRIDE \"${VERSIONOVERRIDE}\"" +fi + # # sanitize # diff --git a/support/getver.sh b/support/getver.sh index 8bd27aa988..ddd31d6bf6 100755 --- a/support/getver.sh +++ b/support/getver.sh @@ -1,7 +1,5 @@ #!/bin/sh -set -e - revision=`cd "$1" && git describe --dirty --abbrev=5 2>/dev/null | sed -e 's/-/./g'` if ! test $revision; then diff --git a/support/version.sh b/support/version.sh index 4d0578b037..cee649507d 100755 --- a/support/version.sh +++ b/support/version.sh @@ -1,7 +1,5 @@ #!/bin/sh -set -e - revision=`$1/support/getver.sh` NEW_REVISION="#define BUILD_VERSION \"$revision\""