Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 38 additions and 22 deletions.
  1. +30 −21 inc/My/Builder.pm
  2. +8 −1 t/002_config.t
View
51 inc/My/Builder.pm
@@ -91,6 +91,7 @@ sub ACTION_code {
if($bp->{buildtype} eq 'use_config_script') {
$self->config_data('script', $bp->{script});
# include path trick - adding couple of addititonal locations
+ $self->set_ld_config($build_out);
$self->config_data('additional_cflags', '-I' . $self->get_path($bp->{prefix} . '/include/smpeg') . ' '.
'-I' . $self->get_path($bp->{prefix} . '/include') . ' ' .
$self->get_additional_cflags);
@@ -102,6 +103,7 @@ sub ACTION_code {
$self->clean_dir($build_out);
$self->extract_binaries($download, $build_out);
$self->set_config_data($build_out);
+ $self->set_ld_config($build_out);
}
elsif($bp->{buildtype} eq 'build_from_sources' ) {
# all the following functions die on error, no need to test ret values
@@ -110,6 +112,7 @@ sub ACTION_code {
$self->clean_dir($build_out);
$self->build_binaries($build_out, $build_src);
$self->set_config_data($build_out);
+ $self->set_ld_config($build_out);
}
# mark sucessfully finished build
@@ -241,14 +244,14 @@ sub set_config_data {
my $L = $My::Utility::cc eq 'cl'
? '/LIBPATH:'
: '-L';
- my $cfg = {
- # defaults
- version => $version,
- prefix => '@PrEfIx@',
- libs => $L . $self->get_path('@PrEfIx@/lib') . ' -lSDLmain -lSDL',
- cflags => '-I' . $self->get_path('@PrEfIx@/include/SDL') . ' -D_GNU_SOURCE=1 -Dmain=SDL_main',
- shared_libs => [ ],
- };
+ my $cfg = $self->config_data('config') || {};
+
+ # defaults
+ $cfg->{version} = $version;
+ $cfg->{prefix} = '@PrEfIx@';
+ $cfg->{libs} = $L . $self->get_path('@PrEfIx@/lib') . ' -lSDLmain -lSDL';
+ $cfg->{cflags} = '-I' . $self->get_path('@PrEfIx@/include/SDL') . ' -D_GNU_SOURCE=1 -Dmain=SDL_main';
+ $cfg->{ld_shared_libs} = [ ];
# overwrite values available via sdl-config
my $bp = $self->config_data('build_prefix') || $prefix;
@@ -263,11 +266,22 @@ sub set_config_data {
}
}
+ # write config
+ $self->config_data('additional_cflags', '-I' . $self->get_path('@PrEfIx@/include') . ' ' .
+ '-I' . $self->get_path('@PrEfIx@/include/smpeg') . ' ' .
+ $self->get_additional_cflags);
+ $self->config_data('additional_libs', $self->get_additional_libs);
+ $self->config_data('config', $cfg);
+}
+
+sub set_ld_config {
+ my( $self, $build_out ) = @_;
+ my ($version, $prefix, $incdir, $libdir) = find_SDL_dir(rel2abs($build_out));
+ my $cfg = $self->config_data('config') || {};
my $dlext = get_dlext();
# find ld_shared_libs and create symlinks if necessary
my $symlink_exists = eval { symlink("",""); 1 };
- if($symlink_exists)
- {
+ if($symlink_exists) {
my @shlibs_ = find_file($build_out, qr/\.$dlext[\d\.]+$/);
foreach my $full (@shlibs_){
$full =~ qr/(.*\.$dlext)[\d\.]+$/;
@@ -278,9 +292,8 @@ sub set_config_data {
# find and set ld_shared_libs
my @shlibs = find_file($build_out, qr/\.$dlext$/);
- my $p = rel2abs($prefix);
- $_ =~ s/^\Q$prefix\E/\@PrEfIx\@/ foreach (@shlibs);
- $cfg->{ld_shared_libs} = [ @shlibs ];
+# my $p = rel2abs($prefix);
+ $_ =~ s/^\Q$prefix\E/\@PrEfIx\@/ foreach (@shlibs);
# set ld_paths and ld_shlib_map
my %tmp = ();
@@ -308,6 +321,10 @@ sub set_config_data {
}
};
+ $cfg->{ld_shared_libs} = [ @shlibs ];
+ $cfg->{ld_paths} = [ keys %tmp ];
+ $cfg->{ld_shlib_map} = \%shlib_map;
+
my $have_libs = $self->notes('have_libs');
for(qw(pthread z jpeg tiff png ogg vorbis vorbisfile freetype
pangoft2 pango gobject gmodule glib fontconfig expat )) {
@@ -316,15 +333,7 @@ sub set_config_data {
$shlib_map{$_} = $have_libs->{$_}->[1];
}
}
-
- $cfg->{ld_paths} = [ keys %tmp ];
- $cfg->{ld_shlib_map} = \%shlib_map;
- # write config
- $self->config_data('additional_cflags', '-I' . $self->get_path('@PrEfIx@/include') . ' ' .
- '-I' . $self->get_path('@PrEfIx@/include/smpeg') . ' ' .
- $self->get_additional_cflags);
- $self->config_data('additional_libs', $self->get_additional_libs);
$self->config_data('config', $cfg);
}
View
9 t/002_config.t
@@ -1,6 +1,6 @@
# t/002_config.t - test config() functionality
-use Test::More tests => 5;
+use Test::More tests => 6;
use Alien::SDL;
### test some config strings
@@ -19,6 +19,13 @@ foreach (@{Alien::SDL->config('ld_shared_libs')}) {
}
is( $l_result, 1, "Testing 'ld_shared_libs'" );
+### check if list of ld_shlib_map contains existing files
+my $m_result = 1;
+foreach (values %{Alien::SDL->config('ld_shlib_map')}) {
+ $m_result = 0 unless (-e $_);
+}
+is( $m_result, 1, "Testing 'ld_shlib_map'" );
+
### check if list of ld_paths contains existing directories
my $p_result = 1;
foreach (@{Alien::SDL->config('ld_paths')}) {

No commit comments for this range

Something went wrong with that request. Please try again.