Skip to content
Open

. #71

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions inc/My/Builder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand Down
2 changes: 1 addition & 1 deletion server/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down