From c615507e150592895980608d00601beed16d28b9 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 13 Mar 2011 17:32:00 +0000 Subject: Set version using testament.h instead of old ARexx script svn path=/trunk/netsurf/; revision=12028 --- Makefile | 22 -------------------- amiga/arexx.c | 21 ++++++++++--------- amiga/version.c | 26 ++++++++++++++++++++++++ amiga/version.rexx | 55 -------------------------------------------------- utils/svn-testament.pl | 6 ++++++ 5 files changed, 43 insertions(+), 87 deletions(-) create mode 100644 amiga/version.c delete mode 100644 amiga/version.rexx diff --git a/Makefile b/Makefile index ac7b56090..af2d8187a 100644 --- a/Makefile +++ b/Makefile @@ -422,28 +422,6 @@ $(RSRC_BEOS): $(RDEF_BEOS) $(RDEP_BEOS) $(Q)$(BEOS_RC) -o $@ $< endif -ifeq ($(findstring amiga,$(TARGET)),amiga) -clean-amiga-version: - $(VQ)echo " CLEAN: amiga/version.c" - $(Q)$(RM) amiga/version.c -CLEANS += clean-amiga-version - -ifeq ($(HOST),amiga) -amiga/version.c: amiga/version.rexx - $(VQ)echo " AREXX: amiga/version.rexx" - $(Q)rx amiga/version.rexx >amiga/version.c -else -amiga/version.c: - $(Q)echo '/* This file was automatically generated by version.rexx */' >amiga.version.c - $(Q)echo 'static const __attribute__((used)) char *verstag = "\\0$$VER: NetSurf 3.1415(1234)\\0";' >>amiga/version.c - $(Q)echo 'const char * const versvn = "SVN1415";' >>amiga/version.c - $(Q)echo 'const char * const verdate = "1234";' >>amiga/version.c - $(Q)echo 'const char * const verarexx = "3.1415";' >>amiga/version.c - $(Q)echo 'const int verver = 3;' >>amiga/version.c - $(Q)echo 'const int verrev = 1234;' >>amiga/version.c -endif -endif - ifeq ($(TARGET),riscos) # Native RO build is different as 1) it can't do piping and 2) ccres on # RO does not understand Unix filespec diff --git a/amiga/arexx.c b/amiga/arexx.c index f8afbde32..d5ccce493 100755 --- a/amiga/arexx.c +++ b/amiga/arexx.c @@ -18,24 +18,25 @@ #include "amiga/os3support.h" -#include "arexx.h" -#include -#include -#include +#include "amiga/arexx.h" #include "desktop/browser.h" #include "desktop/history_core.h" #include "amiga/gui.h" -#include -#include #include "amiga/download.h" #include "amiga/options.h" +#include "utils/testament.h" + +#include +#include +#include +#include +#include #include #include +#include const char * const verarexx; -const int verver; -const int verrev; const char * const netsurf_version; const int netsurf_version_major; const int netsurf_version_minor; @@ -376,7 +377,7 @@ STATIC VOID rx_version(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__(( { if(cmd->ac_ArgList[1]) { - if((verver > *(ULONG *)cmd->ac_ArgList[0]) || ((verrev >= *(ULONG *)cmd->ac_ArgList[1]) && (verver == *(ULONG *)cmd->ac_ArgList[0]))) + if((netsurf_version_major > *(ULONG *)cmd->ac_ArgList[0]) || ((atoi(WT_REVID) >= *(ULONG *)cmd->ac_ArgList[1]) && (netsurf_version_major == *(ULONG *)cmd->ac_ArgList[0]))) { strcpy(result,"1"); } @@ -387,7 +388,7 @@ STATIC VOID rx_version(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__(( } else if(cmd->ac_ArgList[0]) { - if((verver >= *(ULONG *)cmd->ac_ArgList[0])) + if((netsurf_version_major >= *(ULONG *)cmd->ac_ArgList[0])) { strcpy(result,"1"); } diff --git a/amiga/version.c b/amiga/version.c new file mode 100644 index 000000000..b2e01a1f0 --- /dev/null +++ b/amiga/version.c @@ -0,0 +1,26 @@ +/* + * Copyright 2011 Chris Young + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "utils/testament.h" + +#define NETSURF_VERSION_MAJOR "3" + +static const __attribute__((used)) char *verstag = "\0$VER: NetSurf " NETSURF_VERSION_MAJOR "." WT_REVID " (" WT_COMPILEDATE ")\0"; +const char * const versvn = "SVN " WT_REVID; +const char * const verdate = WT_COMPILEDATE; +const char * const verarexx = NETSURF_VERSION_MAJOR "." WT_REVID; diff --git a/amiga/version.rexx b/amiga/version.rexx deleted file mode 100644 index f5e085031..000000000 --- a/amiga/version.rexx +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008 Chris Young - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* This file generates an AmigaOS compliant version string in version.c */ - -address command 'svn info >t:ns_svn' - -if open('tmp','t:ns_svn','R') then do - do until word(var,1) = "REVISION:" - var = upper(readln('tmp')) - end - dummy = close('tmp') - address command 'delete t:ns_svn' -end - -svnrev = word(var,2) - -if open('tmp','desktop/version.c','R') then do - do until word(var,3) = "NETSURF_VERSION_MAJOR" - var = upper(readln('tmp')) - end - dummy = close('tmp') -end - -majorver = compress(word(var,5),";") - -/* ARexx only returns two digits for year, but AmigaOS version string dates are - * supposed to have four digits for the year, so the below specifies the prefix - * (century-1 really). This will need to be increased in 2100 and every hundred - * years thereafter, if this script is still in use :-) */ -century = 20 -date = translate(left(date('E'),6) || century || right(date('E'),2),'.','/') - -say '/* This file was automatically generated by version.rexx */' -say 'static const __attribute__((used)) char *verstag = "\0$VER: NetSurf' majorver || '.' || svnrev '(' || date || ')\0";' -say 'const char * const versvn = "SVN' svnrev || '";' -say 'const char * const verdate = "' || date || '";' -say 'const char * const verarexx = "' || majorver || '.' || svnrev || '";' -say 'const int verver =' majorver || ';' -say 'const int verrev =' svnrev || ';' diff --git a/utils/svn-testament.pl b/utils/svn-testament.pl index 30240e927..e0f678b66 100755 --- a/utils/svn-testament.pl +++ b/utils/svn-testament.pl @@ -60,6 +60,11 @@ my %userinfo; # The information about the current user $userinfo{GECOS} = $gecos; } +# The current date, in AmigaOS version friendly format (dd.mm.yyyy) + +my $compiledate = `date +%d.%m.%Y`; +chomp $compiledate; + # Spew the testament out my $testament = ""; @@ -77,6 +82,7 @@ $hostname =~ s/"/\\"/g; $testament .= "#define WT_ROOT \"$qroot\"\n"; $testament .= "#define WT_HOSTNAME \"$hostname\"\n"; +$testament .= "#define WT_COMPILEDATE \"$compiledate\"\n"; my $url = $svninfo{url}; # This only works on 1.3.x and above -- cgit v1.2.3