Set version using testament.h instead of old ARexx script

svn path=/trunk/netsurf/; revision=12028
This commit is contained in:
Chris Young 2011-03-13 17:32:00 +00:00
parent 04c43fbfba
commit c615507e15
5 changed files with 43 additions and 87 deletions

View File

@ -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

View File

@ -18,24 +18,25 @@
#include "amiga/os3support.h"
#include "arexx.h"
#include <reaction/reaction_macros.h>
#include <string.h>
#include <proto/intuition.h>
#include "amiga/arexx.h"
#include "desktop/browser.h"
#include "desktop/history_core.h"
#include "amiga/gui.h"
#include <proto/dos.h>
#include <proto/exec.h>
#include "amiga/download.h"
#include "amiga/options.h"
#include "utils/testament.h"
#include <string.h>
#include <math.h>
#include <proto/intuition.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/clicktab.h>
#include <gadgets/clicktab.h>
#include <reaction/reaction_macros.h>
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");
}

26
amiga/version.c Normal file
View File

@ -0,0 +1,26 @@
/*
* Copyright 2011 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#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;

View File

@ -1,55 +0,0 @@
/*
* Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/* 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 || ';'

View File

@ -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