Cuberite Forum
subwcrev for linux equivalent - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: subwcrev for linux equivalent (/thread-363.html)



subwcrev for linux equivalent - xoft - 02-26-2012

I'd like to ask our *nix teammembers if they know of a good program that can mimic the subwcrev utility and runs on their *nix.

I'd like to include the revision number in the MCS build; I'd use subwcrev for Windows builds, but have no idea about *nix builds. Would anyone suggest a reasonable solution?

Thanks.


RE: subwcrev for linux equivalent - tbar - 02-27-2012

Take a look at: http://svnwcrev.tigris.org

It's supposed to be a "port" of subwcrev for *nix. I don't know which state it's in but I'm betting that if you only need the revision number then it'll work just fine.

(You could also do a "svn info" and then parse output...)
----------

As MCS is using GNU make the following might be just right for this task:
http://subversion.apache.org/faq.html#version-value-in-source


RE: subwcrev for linux equivalent - xoft - 02-28-2012

From what I've read, svnwcrev is not maintained and may be unusable for svn 1.7 repositories. Can you try it out? Ideally try to make it work on the $/Install/WCVersion.cmd.template file and see if what you get (should be "set WCREV=328").
Also, if it works, can you provide instructions for us non-*nixers to get it working? Smile


RE: subwcrev for linux equivalent - tbar - 02-29-2012

I've attached a couple of diff-files (created using svn diff; renamed to get them attached thos post) which changes the GNUmakefile and cServer.cpp. This shows how the svn-information is generated at compile-time and how it is to be used in the code Wink

I hope this is what you are looking for?


RE: subwcrev for linux equivalent - xoft - 02-29-2012

Not exactly what I had in mind, but close enough.

I can't do a similar thing for windows, so instead I need the svnversion or whatever tool to process a file, WCVersion.h, that only contains the SVN revision number defined as a macro. On Windows, I can make that file a .template and it will be automagically processed into the correct header by subwcrev; I'm looking for a similar way in *nix. Thus:

WCVersion.h.template contents:
#define WCREV $WCREV$

From that, subwcrev generates WCVersion.h:
#define WCREV 340

Whichever file in the project needs the revision number, just does an #include "WCVersion.h"

Can this be done easily on *nix?


RE: subwcrev for linux equivalent - tbar - 02-29-2012

I'm not a makefile specialist. If you put this in the GNUmakefile WCVersion.h gets generated with the info but I don't know where to put it in GNUMakefile to get it to work everytime...

Code:
WCVersion.h:
        @rm -f WCVersion.h
        @echo -ne "#define WCREV " > WCVersion.h
        @svnversion -n . >> WCVersion.h



RE: subwcrev for linux equivalent - xoft - 03-14-2012

I'd prefer something that could actually replace things in WCVersion.h, rather than synthetizing it from scratch. If we ever decide to put something else into the file (such as last commit's date etc.)