perlalien / alien-build Goto Github PK
View Code? Open in Web Editor NEWBuild external dependencies for use in CPAN
Build external dependencies for use in CPAN
What exists is somewhat incomplete in parts, out of date in others and there is no tutorial.
Inspiration and lessons learned can be drawn from #42
Two types of plugins should be addressed in said documentation:
I am assigning this to me, but anyone else should feel welcome to make comments or PRs to improve this.
02packages.details.txt:
Alien::Build 1.28 P/PL/PLICEASE/Alien-Build-1.28.tar.gz
...
Alien::Build::Plugin::Gather::IsolateDynamic 1.32 P/PL/PLICEASE/Alien-Build-1.32.tar.gz
I see this issue on 2 Darwin machines:
http://www.cpantesters.org/cpan/report/6ddf783c-6c99-11e7-bdef-1db1708aea55
Path::Tiny paths require defined, positive-length parts at /Users/hornenj/.cpan/build/Alien-Build-0.66-4/blib/lib/Alien/Build/Util.pm line 107.
make: *** [Makefile:984: _alien/mm/build] Error 255
Also seen here:
http://www.cpantesters.org/cpan/report/55f07862-6c98-11e7-9c0b-198b708aea55
So far we only search/use lib/pkgconfig
. This usually covers most things that we would care about since most libraries that we are alienizing are arch-dependent and will install their .pc
files into lib/pkgconfig
. Strictly speaking we should also support share/pkgconfig
. There are a number of places where tweaks will need to be added, and tests should be extended to get good coverage for this issue.
build_ffi hook should build DLLs for FFI. It should do this as a fresh install from a fresh extract. It should install the DLLs to $dist_dir/dynamic
instead of $dist_dir/lib
. It should do this after the main build hook. It should be easy to make this optional.
prove -lvm t/alien_build_plugin_extract_archivetar.t
t/alien_build_plugin_extract_archivetar.t ..
# Seeded srand with seed '20170712' from local date.
Unsuccessful stat on filename containing newline at t/alien_build_plugin_extract_archivetar.t line 34.
Unsuccessful stat on filename containing newline at t/alien_build_plugin_extract_archivetar.t line 40.
Unsuccessful stat on filename containing newline at t/alien_build_plugin_extract_archivetar.t line 40.
not ok 1 - archive {
ok 1 - with extension tar {
ok 1 - directory created
# dir = /tmp/vF25sH4t8K/root/build_3hXt/foo-1.00
ok 2 - configure exists
ok 3 - foo.c exists
1..3
}
not ok 2 - with extension tar.bz2 {
# No files found for /home/ollisg/dev/Alien-Build/corpus/dist/foo-1.00.tar.bz2 at /home/ollisg/dev/Alien-Build/lib/Alien/Build/Plugin/Extract/ArchiveTar.pm line 78
not ok 1 - directory created
# Failed test 'directory created'
# at t/alien_build_plugin_extract_archivetar.t line 34.
# dir = no files extracted at /home/ollisg/dev/Alien-Build/lib/Alien/Build.pm line 991.
not ok 2 - configure exists
# Failed test 'configure exists'
# at t/alien_build_plugin_extract_archivetar.t line 40.
not ok 3 - foo.c exists
# Failed test 'foo.c exists'
# at t/alien_build_plugin_extract_archivetar.t line 40.
1..3
}
# Failed test 'with extension tar.bz2'
# at t/alien_build_plugin_extract_archivetar.t line 43.
ok 3 - with extension tar.gz {
ok 1 - directory created
# dir = /tmp/KAHnB0ASz5/root/build_SVbs/foo-1.00
ok 2 - configure exists
ok 3 - foo.c exists
1..3
}
1..3
}
# Failed test 'archive'
# at t/alien_build_plugin_extract_archivetar.t line 45.
1..1
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
Test Summary Report
-------------------
t/alien_build_plugin_extract_archivetar.t (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=1, Tests=1, 0 wallclock secs ( 0.01 usr 0.01 sys + 0.13 cusr 0.01 csys = 0.16 CPU)
Result: FAIL
For thems that are concerned about the security thing.
Either Download or Extract may know enough from the Prefer plugin to guess the version fairly accurately.
One consideration of this is how it will affect Alien::Foo->build
Is there generic mechanism to ignore an installed library? For example, if an existing system library is out-of-date, I'd like to be able to use an environment variable to inform Alien::Build to ignore it and download and build from scratch.
Thanks,
Diab
Inspired by #122
Also possibly related ExtUtils::PkgConfig
integration. Also definitely related, further FFI::CheckLib
integration
The idea is to get these tools commonly used by modules to fallback on Alien based providers if the system does not provide them.
The upside: If a user or integrator explicitly installs Alien::Foo
before installing Foo::XS
then then he doesn't need to install the system library. In the case of #122 this could mean that you could install stuff into a ./local
directory. We get some benefit from Alien
without having to push Foo::XS
to adopt Alien which usually has a political dimension.
The downside: if this works too well then it may reduce the incentive for Foo::XS
owner to adopt Alien. Example: In the case of #122, the requestor wanted to specifically bundle libfoo packages in his ./local
in order to be able to deploy that to machines without having to worry about if they had the dev libs. Obviously if his dev machines does have the dev libs then the smartness of only falling back on Alien when the system library is not available is a problem. On the other hand if Foo::XS
used Alien::Foo
directly, then the user/integrator can ensure that ALIEN_FORCE
is set when he/she installs Alien::Foo
into ./local
.
Your alien dist Alien-Foo
should be able to have a patch
directory which is accessible from %{alien.install.patch}
, and gets copied into $dist_dir/_alien/patch
. Once that happens you can do this:
use alienfile;
share {
patch [ '%{patch} %{alien.install.patch}/foo.diff' ];
};
A plugin which does some automation on the version number, platform, etc would also be handy.
https://gist.github.com/plicease/b90749296cb8f15de8c865da550af8bf
probably key diagnostic : skipping incompatible N:\lang\perl\activestate\x86\v5.24.1\lib\CORE/libperl524.a when searching for -lperl524
zaki@MSI MINGW64 ~/.cpanm/work/1501782127.6612/Alien-Build-0.80
$ prove -lvr t/alien_build_plugin_pkgconfig_commandline.t
# Failed test at t/alien_build_plugin_pkgconfig_commandline.t line 77.
# +------------------+------------------+----+------------------+--------+
# | PATH | GOT | OP | CHECK | LNs |
# +------------------+------------------+----+------------------+--------+
# | | HASH(0x3b059e8) | | <HASH> | 70, 76 |
# | | | | | |
# | {cflags} | -fPIC -IC:/msys6 | =~ | (?^:-I/test/incl | 71 |
# | | 4/home/zaki/.cpa | | ude/foo) | |
# | | nm/work/15017821 | | | |
# | | 27.6612/Alien-Bu | | | |
# | | ild-0.80/corpus/ | | | |
# | | include/foo\N{U+ | | | |
# | | 20} | | | |
# | | | | | |
# | {libs} | -LC:/msys64/home | eq | -L/test/lib -lfo | 72 |
# | | /zaki/.cpanm/wor | | o\N{U+20} | |
# | | k/1501782127.661 | | | |
# | | 2/Alien-Build-0. | | | |
# | | 80/corpus/lib -l | | | |
# | | foo\N{U+20} | | | |
# | | | | | |
# | {libs_static} | -LC:/msys64/home | eq | -L/test/lib -lfo | 73 |
# | | /zaki/.cpanm/wor | | o -lbar -lbaz\N{ | |
# | | k/1501782127.661 | | U+20} | |
# | | 2/Alien-Build-0. | | | |
# | | 80/corpus/lib -l | | | |
# | | foo -lbar -lbaz\ | | | |
# | | N{U+20} | | | |
# +------------------+------------------+----+------------------+--------+
# Failed test 'system available, okay'
# at t/alien_build_plugin_pkgconfig_commandline.t line 89.
# Failed test at t/alien_build_plugin_pkgconfig_commandline.t line 139.
# +-----------------+-----------------+----+-----------------+----------+
# | PATH | GOT | OP | CHECK | LNs |
# +-----------------+-----------------+----+-----------------+----------+
# | | HASH(0x36e57c0) | | <HASH> | 113, 138 |
# | | | | | |
# | {libs} | -LC:/msys64/hom | eq | -L/test/lib -lx | 114 |
# | | e/zaki/.cpanm/w | | or\N{U+20} | |
# | | ork/1501782127. | | | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/l | | | |
# | | ib -lxor\N{U+20 | | | |
# | | } | | | |
# | | | | | |
# | {libs_static} | -LC:/msys64/hom | eq | -L/test/lib -lx | 115 |
# | | e/zaki/.cpanm/w | | or -lxor1\N{U+2 | |
# | | ork/1501782127. | | 0} | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/l | | | |
# | | ib -lxor -lxor1 | | | |
# | | \N{U+20} | | | |
# | | | | | |
# | {cflags} | -IC:/msys64/hom | eq | -I/test/include | 116 |
# | | e/zaki/.cpanm/w | | /xor\N{U+20} | |
# | | ork/1501782127. | | | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/i | | | |
# | | nclude/xor\N{U+ | | | |
# | | 20} | | | |
# | | | | | |
# | {alt} | HASH(0x3cbbda8) | | <HASH> | 136 |
# | {alt}{xor} | HASH(0x3cb85c8) | | <HASH> | 127 |
# | | | | | |
# | {alt}{xor}{libs | -LC:/msys64/hom | eq | -L/test/lib -lx | 121 |
# | } | e/zaki/.cpanm/w | | or\N{U+20} | |
# | | ork/1501782127. | | | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/l | | | |
# | | ib -lxor\N{U+20 | | | |
# | | } | | | |
# | | | | | |
# | {alt}{xor}{libs | -LC:/msys64/hom | eq | -L/test/lib -lx | 122 |
# | _static} | e/zaki/.cpanm/w | | or -lxor1\N{U+2 | |
# | | ork/1501782127. | | 0} | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/l | | | |
# | | ib -lxor -lxor1 | | | |
# | | \N{U+20} | | | |
# | | | | | |
# | {alt}{xor}{cfla | -IC:/msys64/hom | eq | -I/test/include | 123 |
# | gs} | e/zaki/.cpanm/w | | /xor\N{U+20} | |
# | | ork/1501782127. | | | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/i | | | |
# | | nclude/xor\N{U+ | | | |
# | | 20} | | | |
# | | | | | |
# | {alt}{xor-chill | HASH(0x3cbbc70) | | <HASH> | 134 |
# | out} | | | | |
# | | | | | |
# | {alt}{xor-chill | -LC:/msys64/hom | eq | -L/test/lib -lx | 129 |
# | out}{libs} | e/zaki/.cpanm/w | | or-chillout\N{U | |
# | | ork/1501782127. | | +20} | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/l | | | |
# | | ib -lxor-chillo | | | |
# | | ut\N{U+20} | | | |
# | | | | | |
# | {alt}{xor-chill | -LC:/msys64/hom | eq | -L/test/lib -lx | 130 |
# | out}{libs_stati | e/zaki/.cpanm/w | | or-chillout\N{U | |
# | c} | ork/1501782127. | | +20} | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/l | | | |
# | | ib -lxor-chillo | | | |
# | | ut\N{U+20} | | | |
# | | | | | |
# | {alt}{xor-chill | -IC:/msys64/hom | eq | -I/test/include | 131 |
# | out}{cflags} | e/zaki/.cpanm/w | | /xor\N{U+20} | |
# | | ork/1501782127. | | | |
# | | 6612/Alien-Buil | | | |
# | | d-0.80/corpus/i | | | |
# | | nclude/xor\N{U+ | | | |
# | | 20} | | | |
# +-----------------+-----------------+----+-----------------+----------+
# Failed test 'all found in system'
# at t/alien_build_plugin_pkgconfig_commandline.t line 141.
# Failed test 'system multiple'
# at t/alien_build_plugin_pkgconfig_commandline.t line 143.
t/alien_build_plugin_pkgconfig_commandline.t ..
ok 1 - has bin_name
# it be pkg-config
# PKG_CONFIG_PATH=C:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/lib/pkgconfig
ok 2 - system not available {
# Alien::Build::CommandSequence> + pkg-config --exists bogus
# Alien::Build> error in probe (will do a share install): external command failed at C:\msys64\home\zaki\.cpanm\work\1501782127.6612\Alien-Build-0.80\lib/Alien/Build/CommandSequence.pm line 49.
# Alien::Build> Don't panic, we will attempt a share build from source if possible.
# Alien::Build> Do not file a bug unless you expected a system install to succeed.
ok 1
1..1
}
ok 3 - system available, wrong version {
# Alien::Build::CommandSequence> + pkg-config --exists foo
# Alien::Build::CommandSequence> + pkg-config --atleast-version=1.2.4 foo
# Alien::Build> error in probe (will do a share install): external command failed at C:\msys64\home\zaki\.cpanm\work\1501782127.6612\Alien-Build-0.80\lib/Alien/Build/CommandSequence.pm line 49.
# Alien::Build> Don't panic, we will attempt a share build from source if possible.
# Alien::Build> Do not file a bug unless you expected a system install to succeed.
ok 1
1..1
}
not ok 4 - system available, okay {
# Alien::Build::CommandSequence> + pkg-config --exists foo
# Alien::Build::CommandSequence> + pkg-config --atleast-version=1.2.3 foo
ok 1
# Alien::Build::CommandSequence> + pkg-config --exists foo
# Alien::Build::CommandSequence> + pkg-config --cflags foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --cflags foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --libs foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --libs foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --modversion foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --modversion foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --cflags foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --cflags foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --libs foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --libs foo
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::Plugin::Core::Legacy> adding legacy hash to config
# Alien::Build::Plugin::Core::Gather> mkdir -p C:/Users/zaki/AppData/Local/Temp/362uhVUFu0/stage/_alien
not ok 2
# cflags_static = -fPIC -IC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/include/foo
ok 3
1..3
}
not ok 5 - system multiple {
not ok 1 - all found in system {
ok 1 - alienfile compiles
ok 2 - alien install type is system
ok 3 - alien builds okay
# Alien::Build::CommandSequence> + pkg-config --exists xor
# Alien::Build::CommandSequence> + pkg-config --exists xor-chillout
# Alien::Build::CommandSequence> + pkg-config --cflags xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --cflags xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --cflags xor-chillout
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --libs xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --libs xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --libs xor-chillout
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --modversion xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --modversion xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --modversion xor-chillout
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --cflags xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --cflags xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --cflags xor-chillout
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --libs xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --libs xor
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::CommandSequence> + pkg-config --static --libs xor-chillout
# Alien::Build::CommandSequence> [output consumed by Alien::Build recipe]
# Alien::Build::Plugin::Core::Legacy> adding legacy hash to config
# Alien::Build::Plugin::Core::Gather> mkdir -p C:/Users/zaki/AppData/Local/Temp/v04br0Q1dY/stage/_alien
# $VAR1 = {
# 'libs' => '-LC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/lib -lxor ',
# 'prefix' => 'C:/Users/zaki/AppData/Local/Temp/v04br0Q1dY/prefix',
# 'legacy' => {
# 'name' => 'xor',
# 'finished_installing' => 1,
# 'version' => '4.2.1',
# 'install_type' => 'system',
# 'original_prefix' => 'C:/Users/zaki/AppData/Local/Temp/v04br0Q1dY/prefix'
# },
# 'distdir' => 'C:/Users/zaki/AppData/Local/Temp/v04br0Q1dY/prefix',
# 'version' => '4.2.1',
# 'cflags' => '-IC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/include/xor ',
# 'libs_static' => '-LC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/lib -lxor -lxor1 ',
# 'alt' => {
# 'xor-chillout' => {
# 'libs' => '-LC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/lib -lxor-chillout ',
# 'cflags_static' => '-IC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/include/xor ',
# 'version' => '4.2.2',
# 'libs_static' => '-LC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/lib -lxor-chillout ',
# 'cflags' => '-IC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/include/xor '
# },
# 'xor' => {
# 'cflags_static' => '-IC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/include/xor ',
# 'libs' => '-LC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/lib -lxor ',
# 'cflags' => '-IC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/include/xor ',
# 'libs_static' => '-LC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/lib -lxor -lxor1 ',
# 'version' => '4.2.1'
# }
# },
# 'cflags_static' => '-IC:/msys64/home/zaki/.cpanm/work/1501782127.6612/Alien-Build-0.80/corpus/include/xor ',
# 'alien_build_version' => '0.80',
# 'install_type' => 'system'
# };
not ok 4
1..4
}
1..1
}
1..5
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/5 subtests
Test Summary Report
-------------------
t/alien_build_plugin_pkgconfig_commandline.t (Wstat: 512 Tests: 5 Failed: 2)
Failed tests: 4-5
Non-zero exit status: 2
Files=1, Tests=5, 2 wallclock secs ( 0.06 usr + 0.03 sys = 0.09 CPU)
Result: FAIL
Should make AB work as though the environment variable isn't even set.
Prefer::SortVersions
is only IMO only sort of okay, but it probably covers 95% of all cases. That said it would be nice for Download::Negotiate
to make it easier to customize the sort for that 5% of cases. Right now you can do this like thus:
use alienfile;
probe sub { 'share' };
share {
start_url 'https://github.com/premake/premake-core/releases';
plugin 'Download';
plugin 'Decode::HTML';
meta->register_hook(prefer => sub {
my($build, $res) = @_;
...
});
};
I would like to improve this by adding a prefer
property that can be one of:
alienfile
to add either a hook or plugin.Prefer::OtherPreferPlugin
.Like the version
property the prefer
property should imply the use of an appropriate decode plugin.
Examples:
share {
start_url '...';
plugin Download => (
prefer => 0,
);
plugin 'Prefer::OtherPreferPlugn';
};
share {
start_url '...';
plugin Download => (
prefer => 0,
);
meta->register_hook(
prefer => sub {
my($build, $res) = @_;
...
},
);
};
# xxx do not implment
share {
start_url '...';
plugin Download => (
prefer => 'Prefer::OtherPreferPlugn',
);
};
share {
start_url '...';
plugin Download => (
prefer => sub {
my($build, $res) = @_;
...
},
);
};
appropriate tests should be added to t/alien_build_plugin_download_negotiate.t
.
My thinking about this came up in the discussion on #42.
Noticed this in Libbz2:
use alienfile;
share {
patch [ '%{patch} ...' ];
}
pulls in Alien::patch
as a build require, but should only pull it in as build dynamically. May be a Dist::Zilla::Plugin::AlienBuild
bug.
It would be good to get better coverage on appveyor. At the moment we are using the last major version of Strawberry 5.24.0 (dmake) and not the latest Strawberry 5.26.0 (gmake). Since that is a major configuration change that AB has to deal with it would be good to test both. It would also be good to test Cygwin and MSYS / MinGW. Testing 64 bit Perls may also be useful, but probably less so.
(Even some useful subset of these would be useful)
After testing, AB should be installed, and then we should build some key Aliens to make sure they work. Not 100% sure which are best but candidates:
Right now, to properly chain probe hooks you need to return system
for a system install and die for a share install. The logic should work so that if you return share
it tries the other hook, just in case one of them can get a system
result. Arguably a design bug, but it is still usable as is.
A definite "nice to have" would be to see if the already installed alien is latest and sufficient and thus doing a share build is redundant. Challenges:
Test::Alien
tests need to be able to work when the lib is already in the installed location (not blib)The benefit here is that reinstalling an Alien just because there is a new version but no change in the package would be much faster.
It appears there are some dependencies that aren't detected by the build process.
URI
URI::file
URI::Escape
File::Listing
The upshot is CPAN test failures in my Alien plugin module Alien::Build::Plugin::Cleanse::BuildDir, e.g.:
http://www.cpantesters.org/cpan/report/d15f1884-9445-11e8-98d5-bb14e5798fec
These are called conditionally, e.g. $meta->add_requires('share' => 'URI' => 0 );
so have been missed by the dependency scanning in the build process (if my understanding of Dist::Zilla is correct).
I note that the Alien::Base tests that use URI are conditional, so maybe you already know about this. https://github.com/Perl5-Alien/Alien-Build/blob/177af53c52b12b79342dc5ebb452bc4c5b490538/t/alien_build_plugin_fetch_local.t#L140
It's simple enough for me to work around, but should perhaps be fixed upstream.
Thanks,
Shawn.
We test to see if it is in the PATH
on a recent install I noticed that one of the pkg-config tests failed because it was using /usr/bin/perl, and PERL5LIB with perlbrew libs in it. Thing is I am not sure if at configure time PERL5LIB is set in the same way as test time, so this may not even be detectable.
PkgConfig plugins will need to be updated appropriately as well.
Low priority since this is more an bug in the environment, but would be good to be able to work around it.
This issue only seems to occur in Windows:
https://ci.appveyor.com/project/wbraswell/alien-jpcre2/build/1.0.94#L3260
perl Makefile.PL
Alien::Build::Plugin::Probe::CBuilder> trying: cflags=-IC:/strawberry/perl/site/lib/auto/share/dist/Alien-PCRE2/include -DPCRE2_STATIC libs=-LC:/strawberry/perl/site/lib/auto/share/dist/Alien-PCRE2/lib -lpcre2-8
Alien::Build::Plugin::Probe::CBuilder> compile failed: error building xs.dll file from 'mytest.c' at C:/strawberry/perl/lib/ExtUtils/CBuilder/Platform/Windows.pm line 129.
Alien::Build::Plugin::Probe::CBuilder> compile failed: gcc -c -s -O2 -DWIN32 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -IC:/strawberry/perl/site/lib/auto/share/dist/Alien-PCRE2/include -DPCRE2_STATIC -s -O2 -I"C:\STRAWB~1\perl\lib\CORE" -I"C:\STRAWB~1\c\include" -o "mytest.o" "mytest.c"
mytest.c:1:10: fatal error: jpcre2.hpp: No such file or directory
#include <jpcre2.hpp>
^~~~~~~~~~~~
compilation terminated.
Alien::Build> error in probe (will do a share install): error building xs.dll file from 'mytest.c' at C:/strawberry/perl/lib/ExtUtils/CBuilder/Platform/Windows.pm line 129.
The same build in Linux does not show any of this output whatsoever:
https://travis-ci.org/wbraswell/alien-jpcre2/jobs/257523753#L6173
This has already been mis-reported to me as an error building Alien::JPCRE2 in Windows, so we definitely need to somehow hide the error or otherwise let the users know not to panic when they see this compile error message.
As reported here:
https://metacpan.org/source/ZMUGHAL/Alien-MuPDF-0.007_02/alienfile#L15
# Using CommandLine to extract rather than ArchiveTar because
# the extraction using ArchiveTar is not always successful on
# Windows. This can happen because the mupdf tarball contains
# long paths that can push the entire path over the 260
# character path limit.
I've been looking into writing an Alien::Build distribution for a library that uses premake
as part of its build process. While reading through the documentation for distribution authors I read about build plugins, and thought that a "Premake" plugin would be the way to go. But there is none in CPAN. So I thought I'd ask what you think about this as a contribution.
I hadn't even heard of the plugin system for Alien::Build until this happened, but I'd be happy to give this a try.
Some questions:
The library in question is Box2D. There is already an Alien::Box2D distribution, but it's outdated because it tries to download the sources from the defunct Google Code website. Looking into fixing that distribution is what sent me down this path.
Both autoconf and cmake support building outside of the source root, eg.:
../source-1.0.0/configre --prefix=...
and
cmake -Dblahblah=foo ../source-1.00/configure
In some cases it would save a lot of copying of files to build in an empty build root with the source root in a different directory.
This came in from cpantesters:
https://gist.github.com/plicease/564081f002dac921aa28579f4680178b
(there was also a pass from the same tester on Solaris, thus intermittent). Here is the key diagnostic:
t/alien_build_plugin_build_autoconf.t ................ ok
Can't exec "testalienSkVBv/foo.pl": No such file or directory at /home/stro/cpan/build/5.26.0/build/Alien-Build-1.16-0/blib/lib/Test/Alien.pm line 623.
# Failed test 'xs'
# at t/alien_build_plugin_build_cmake.t line 96.
# ExtUtils::CBuilder->link failed
# error building /home/stro/cpan/build/5.26.0/build/Alien-Build-1.16-0/gBE7YvyARW/test.so from /home/stro/cpan/build/5.26.0/build/Alien-Build-1.16-0/gBE7YvyARW/test.o at /home/stro/perl/5.26.0/lib/5.26.0/ExtUtils/CBuilder/Base.pm line 321.
# /opt/SUNWspro/bin/cc -G -L/usr/lib -L/usr/ccs/lib -L/opt/sunstudio12.1/prod/lib -L/lib -L/usr/gnu/lib -o /home/stro/cpan/build/5.26.0/build/Alien-Build-1.16-0/gBE7YvyARW/test.so /home/stro/cpan/build/5.26.0/build/Alien-Build-1.16-0/gBE7YvyARW/test.o -L/tmp/VLLBjwPrpR/prefix/lib -lpalindrome -L/tmp/uQgf3EEvQs/prefix/lib -lpalindrome
# ld: fatal: library -lpalindrome: not found
# ld: fatal: file processing errors. No output written to /home/stro/cpan/build/5.26.0/build/Alien-Build-1.16-0/gBE7YvyARW/test.so
# Failed test 'out-of-source'
# at t/alien_build_plugin_build_cmake.t line 110.
t/alien_build_plugin_build_cmake.t ...................
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
This should go into dist.ini
[@Filter]
-remove = MakeMaker
[MakeMaker::Awesome]
header = use Config;
header = use Alien::Foo;
WriteMakefile_arg = CONFIGURE_REQUIRES => { 'Alien::Foo' => '0' }
WriteMakefile_arg = CCFLAGS => Alien::Foo>cflags . ' ' . $Config{ccflags}
WriteMakefile_arg = LIBS => [ Alien::Foo->libs ]
Not sure if this is an xz, openbsd, or environment bug, but I get this from some cpantesters running openbsd
t/alien_build_plugin_decode_html.t ................... ok
t/alien_build_plugin_download_negotiate.t ............ ok
t/alien_build_plugin_extract_archivetar.t ............ ok
t/alien_build_plugin_extract_archivezip.t ............ ok
# Failed test 'no error from extract'
# at t/alien_build_plugin_extract_commandline.t line 49.
# +----------------------------------------------------------+----+-------+
# | GOT | OP | CHECK |
# +----------------------------------------------------------+----+-------+
# | execute failed at /mnt/cpan_build_dir/goku/Alien-Build-1 | eq | |
# | .46-0/blib/lib/Alien/Build/Plugin/Extract/CommandLine.pm | | |
# | line 65.\n | | |
# +----------------------------------------------------------+----+-------+
# [output ]Alien::Build::Plugin::Extract::CommandLine> copy /tmp/Al9YjMcfBa/foo-1.00.tar.xz => /tmp/Al9YjMcfBa/xfoo-1.00.tar.xz
# Alien::Build::Plugin::Extract::CommandLine> + xz -d /tmp/Al9YjMcfBa/xfoo-1.00.tar.xz
# xz: /tmp/Al9YjMcfBa/xfoo-1.00.tar: Cannot set the file group: Operation not permitted
# [exception]execute failed at /mnt/cpan_build_dir/goku/Alien-Build-1.46-0/blib/lib/Alien/Build/Plugin/Extract/CommandLine.pm line 65.
# Failed test 'with extension tar.xz'
# at t/alien_build_plugin_extract_commandline.t line 71.
# Failed test 'archive'
# at t/alien_build_plugin_extract_commandline.t line 73.
t/alien_build_plugin_extract_commandline.t ...........
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/alien_build_plugin_extract_commandline__tar_can.t .. ok
t/alien_build_plugin_extract_directory.t ............. ok
t/alien_build_plugin_extract_negotiate.t ............. ok
t/alien_build_plugin_fetch_curlcommand.t ............. ok
I am unable to reproduce on my own openbsd VM, and other cpantesters do not show this error.
As I was working on p5-Alien-OpenJPEG, I noticed that my builds were failing on Travis just on perl-5.20.
After replicating and comparing module versions, I was able to get the following results that suggest we need an ExtUtils::[email protected] minimum:
vagrant@vagrant-ubuntu-trusty-64:~/project-renard/p5-Alien-OpenJPEG/p5-Alien-OpenJPEG/build-dir-5.20$ for version in 3.21 3.24 3.30 3.35; do cpanm ExtUtils::ParseXS@$version -nq >/dev/null 2>&1; echo -en "ExtUtils::ParseXS@$version\t"; perl -Iblib/lib t/version.t >/dev/null 2>&1 && echo 'success' || echo 'fail'; done
ExtUtils::[email protected] fail
ExtUtils::[email protected] fail
ExtUtils::[email protected] success
ExtUtils::[email protected] success
First saw this on cpantesters:
http://matrix.cpantesters.org/?dist=Alien-Build+0.12
http://www.cpantesters.org/cpan/report/c7bdfb7a-ee46-11e6-bf26-82afc107162b
Was able to reproduce it and isolate the problem to be in Perls of 5.8.7 and earlier. Since the Perl in question is so old, this is a bug, but fixing it is a low priority.
https://gist.github.com/plicease/46bad61b0ee57e3cbc903b126207fbdf
It is pretty borked right now due to escaping rules.
https://metacpan.org/pod/Test::RequiresInternet
In many cases, NO_NETWORK_TESTING=1
should imply ALIEN_INSTALL_TYPE=system
EXCEPT when the alienized packaged is bundled with the Alien. This means most of the logic for this feature would unfortunately probably be in the various plugins, rather than at the Alien::Build
level.
Some thought as to how it should work should probably be done. I think however the interface works, the back end should probably use Crypt::Digest
and allow multiple algorithms SHA256 seems a good recommendation for the moment, but no algo should be hard coded.
Shows you which commands WOULD be run (or perl code place holder since code refs cannot be rendered).
To run tests that run at Perl's test phase, but could be something like make check
or whatnot. Generally my position has been to put these in with the build step, and just always run them. Some would like them to get run at the test phase, so that users have the option of of forcing an install after or in spite of a failed test.
share
block:share {
test [ '%{make} check ];
# likewise with ffi block:
ffi {
test [ '%{make} check' ];
}'
};
This is the most common use case. When building from source many packages provide a check
or test
target in their makefile. It should run from the source build directory (_alien/build_XXXX). It should run before the t/*.t tests.
sys
block:sys {
test ...; # ???
};
I am not 100% sure of the practical use cases for this are. Hence the equivocal synopsis. Should happen in an empty test directory (_alien/test_XXXX). I think this should be included for symmetry.
test ...; # ???
I don't think this should be included. Although it makes sense for symmetry with the gather
directive, I can't think of when you would be able to write a common test that would work both in the build directory on a built source tree, and from an empty directory
$CWD
back into them (currently once we successfully build and stage, this directory is forgotten).It took major work to get Alien::Libbz2
to work on Visual C++. Alien::FFI
also works with some wrappers. Some ideas from both could probably be adapted to a more general solution. Perhaps.
make sure it is clear the alienfile needs to be called alienfile
This FAQ:
says:
Some websites allow an initial request from http but then redirect to https. If you can it is better to specify https, if you cannot, then you can instead use the ssl property on either of those two plugins.
but it would be helpful to provide an example like with the other FAQs. Worth doing a followup for the entire FAQ to make sure that there aren't any other answers that deserve a fleshed out example as well.
%{configure}
helper should include --prefix=%{alien.install.autoconf_prefix}
as explaining why you need autoconf_prefix
is a terrible thing.
There isn't a default download hook currently. Instead we use the fetch, decode and prefer hooks directly if there is no download hook. This is more or less the way we want it to work, but it would be better to have a default hook to actually do that, so that when using the af
command you can use --before
or --after
options on the download hook.
I'd like to move the interface capabilities in Alien::Role::Alt
into core Alien::Base
. ::Alt
should become an empty role that does not alter Alien::Base
for backward compatibility. ::Alt
was created as an experimental interface because there wasn't a strong consensus on how to handle this at the time it was created. I think the interface works pretty well in practice as demonstrated by Alien::GMP
which is working quite well!
error:
testalienmuuv9/test.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xdc80080)
t/test_alien__xs_ok__cpp.t .......................
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
I have not yet been able to reproduce, but I think the bug is in ExtUtils::CBuilder adds the ccflags for C but not C++:
full log:
https://gist.github.com/plicease/9d05f7ddce835ac0d671e096a4e3f192
Idea mentioned here:
use Test::Alien;
my @missing = alienfile_missing($alienfile);
skip_all "Test requires: @missing" if @missing;
Might make sense to do a Test2::Requires::Alienfile
shortcut? Not sure about that one.
Right now this plugin only works for tar.xz files when xz is already in the PATH. It doesn't even work with requires 'Alien::xz', which is a shame!
Useful in CI, as you may be testing a specific install type for the main component that you are testing, but want specific Aliens to use system. Or perhaps you want it to revert to the default logic.
This will probably require some hooks into the Alien-Build core, I don't think it is possible to purely from a plugin atm.
Plugin should be distributed separately from the AB core.
The patch example implies that patch
is a built in, but apparently it is not:
use alienfile;
share {
plugin Download => (
url => 'https://github.com/ericmandel/xpa/archive/v2.1.18.tar.gz'
);
patch [ '%{patch} -p1 < %{.install.patch}/v2.1.18.diffs' ];
plugin Extract => 'tar.gz';
plugin 'Build::Autoconf' => ();
};
results in:
% af install --dry-run
Alien::Build> error in probe (will do a share install): No hooks registered for probe at /proj/axaf/ots/pkgs/perl-5.22/x86_64-linux_debian-7/lib/site_perl/5.22.1/Alien/Build.pm line 282.
Can't locate Alien/patch.pm in @INC (you may need to install the Alien::patch module)
Also, is there a glossary somewhere which defines what the interpolated variables are? Where is %{.install.patch}
?
Part of the hesitation to using and Alien module for well established modules is that it means tacking on a number of new prereqs. (personally think this is a bad argument, because they are pretty reliable prereqs). If we can make Alien usage optional on existing simplistic system probes failing, then I think we could improve adoption. To this end we need compiler and linker wrappers so that the appropriate flags can be calculated after the configure step has completed, and before the build step has started. I propose the wrapper should live in Alien::Build::Wrapper
, and can be called like this:
% perl -MAlien::Build::Wrapper=Alien::Foo,Alien::Bar -e cc -o foo.o -c foo.c
% perl -MAlien::Build::Wrapper=Alien::Foo,Alien::Bar -e ld -o foo foo.o
This technique is already used by PkgConfig::LibPkgConf
which uses Alien::pkgconf
if the system package cannot easily be probed by its own Makefile.PL
.
A few distributions include a data directory in addition to the bin and lib dirs. It would be useful if there were a method in Alien::Base to access it, per shawnlaffan/perl-alien-gdal#12 .
I have a method in Alien::gdal that seems to work well enough for my use case, but it could probably be more generic.
It should be easier to write tests that mock the stages for the plugin that you are writing isn't used. I've usually done stuff like this:
share {
download sub { path('file1')->touch };
extract sub { path('file2')->touch };
...
}
Which is pretty short, but still a tad arcane, and pulls in an extra prereq on Path::Tiny
. (That module is currently a prereq for AB, but from a purity standpoint, anything downstream that uses Path::Tiny
ought to also declare it). Interface tbd. Inspired by:
Needs some design, but if someone wants to work on it and has some ideas, please feel free to comment here or on #native
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.