Permalink
Browse files

Fixed VERSION rewrite.

  • Loading branch information...
1 parent b5d7cf1 commit 0709dc4581868392c0ccf8b413f566db31a72005 @kthakore committed Aug 6, 2010
Showing with 9 additions and 3 deletions.
  1. +2 −0 .gitignore
  2. +6 −2 inc/My/Builder.pm
  3. 0 server/{fb-server.c → fb-server.c_tmp}
  4. +1 −1 server/{net.c → net.c_tmp}
View
2 .gitignore
@@ -41,3 +41,5 @@ Games-FrozenBubble*
lib/Games/FrozenBubble/CStuff.c
lib/Games/FrozenBubble/CStuff.o
bin/fb-server
+server/fb_server.c
+server/net.c
View
8 inc/My/Builder.pm
@@ -13,6 +13,9 @@ use autodie qw(:all move read_file write_file);
use parent 'Module::Build';
use Locale::Maketext::Extract;
+use lib 'lib';
+use Games::FrozenBubble;
+
sub ACTION_run {
my ($self) = @_;
$self->depends_on('code');
@@ -101,13 +104,14 @@ sub ACTION_server {
# so the -DVERSION macro does not work like in the former Makefile.
# Instead, I'll just preprocess the two files with perl.
{
- my $version = $self->dist_version;
+ my $version = $Games::FrozenBubble::RELEASE_VERSION;
# perl -pie again has problems with shell quoting for the -e'' part.
for my $cfile (
- map {catfile($server_directory, $_)} qw(fb-server.c net.c)
+ map {catfile($server_directory, $_)} qw(fb-server.c_tmp net.c_tmp)
) {
my $csource = read_file($cfile);
$csource =~ s{" VERSION "}{$version};
+ $cfile =~ s/_tmp//;
write_file($cfile, $csource);
}
}
View
0 server/fb-server.c → server/fb-server.c_tmp
File renamed without changes.
View
2 server/net.c → server/net.c_tmp
@@ -988,7 +988,7 @@ static char * http_get(char * host, int port, char * path)
}
uname(&uname_);
- user_agent = asprintf_("Frozen-Bubble server version 0.001_1 (protocol version %d.%d) on %s/%s\n", proto_major, proto_minor, uname_.sysname, uname_.machine);
+ user_agent = asprintf_("Frozen-Bubble server version " VERSION " (protocol version %d.%d) on %s/%s\n", proto_major, proto_minor, uname_.sysname, uname_.machine);
buf = asprintf_("GET %s HTTP/0.9\r\nHost: %s\r\nUser-Agent: %s\r\n\r\n", path, host, user_agent);
free(user_agent);
if (write(sock, buf, strlen(buf)) != strlen(buf)) {

0 comments on commit 0709dc4

Please sign in to comment.