Permalink
Browse files

TODO: Fix

  • Loading branch information...
1 parent 9741cf7 commit fae3653c946a030b51fc2b8ab0b48950fa3ae320 @kthakore committed Aug 6, 2010
Showing with 9 additions and 16 deletions.
  1. +8 −15 inc/My/Builder.pm
  2. +1 −1 server/net.c
View
@@ -97,29 +97,22 @@ sub ACTION_server {
my $server_directory = 'server';
my $otarget = 'fb-server';
return if (-e 'bin/'.$otarget );
- # CBuilder doesn't take shell quoting into consideration,
- # 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;
- # 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)
- ) {
- my $csource = read_file($cfile);
- $csource =~ s{" VERSION "}{$version};
- write_file($cfile, $csource);
- }
- }
+
+ require Games::FrozenBubble;
+
+ my $version = ' -DVERSION="'.$Games::FrozenBubble::RELEASE_VERSION.'" ';
{
my $cbuilder = ExtUtils::CBuilder->new;
+ my $cpp = $cbuilder->{config}->{'cppflags'};
+ $cpp = $version. $cpp;
+ $cbuilder->{config}->{'cppflags'} = $cpp;
my @ofiles;
for my $cfile (qw(fb-server.c log.c tools.c game.c net.c)) {
push @ofiles, $cbuilder->compile(
source => catfile($server_directory, $cfile),
extra_compiler_flags => [
- qw(-g -Wall -Werror -pipe), # verbatim from Makefile
+ qw(-g -Wall -Werror -pipe ), # verbatim from Makefile
'-I' . $server_directory, # does not seem to be necessary
$cbuilder->split_like_shell(`pkg-config glib-2.0 --cflags`),
$cbuilder->split_like_shell(`pkg-config glib-2.0 --libs`),
View
@@ -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 fae3653

Please sign in to comment.