-
Notifications
You must be signed in to change notification settings - Fork 3
/
alienfile
60 lines (57 loc) · 2.36 KB
/
alienfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use alienfile;
use File::Spec::Functions qw/catfile/;
# download utility available
plugin 'Probe::CommandLine' => (
command => 'curl',
);
plugin 'Probe::CommandLine' => (
command => 'wget',
secondary => 1,
);
share {
# github release download page changed, stick with jq-1.6 for now
# start_url 'https://github.com/stedolan/jq/releases/';
start_url 'https://github.com/stedolan/jq/releases/expanded_assets/jq-1.6';
# china mirror
#start_url 'https://hub.fastgit.org/stedolan/jq/releases/';
plugin Download => (
filter => qr/^jq-.+?\.tar\.gz$/,
version => qr/[0-9\.]+/,
);
plugin Extract => 'tar.gz';
plugin 'Build::CMake';
build [
# pitch in required cmake stuff
'echo %cd%',
[ '%{cp}', catfile('..', '..', '..', 'jq', 'scripts', 'gen_builtin_inc.pl'), 'scripts' ],
[ '%{cp}', catfile('..', '..', '..', 'jq', 'src', 'setenv.h'), 'src' ],
[ '%{cp}', catfile('..', '..', '..', 'jq', 'src', 'setenv.c'), 'src' ],
[ '%{cp}', catfile('..', '..', '..', 'jq', 'builtin.c.patch'), '.' ],
[ '%{cp}', catfile('..', '..', '..', 'jq', 'CMakeLists.txt'), '.' ],
[ '%{cp}', catfile('..', '..', '..', 'jq', 'Config.cmake.in'), '.' ],
[ '%{cp}', catfile('..', '..', '..', 'jq', 'dist.info'), '.' ],
[ '%{cp}', catfile('..', '..', '..', 'jq', 'jq.pc.cmake.in'), '.' ],
# execute cmake build
[ '%{cmake}', -G => '%{cmake_generator}', ( $^O eq 'MSWin32' ? '-DCMAKE_MAKE_PROGRAM=%{make}' : () ),
'-DBUILD_SHARED_LIBS=OFF', '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
'-DENABLE_MAINTAINER_MODE=OFF', '-DWITH_ONIGURUMA=builtin',
'-DCMAKE_INSTALL_PREFIX=%{.install.prefix}',
'.'
],
'%{make}',
'%{make} install',
];
plugin 'Gather::IsolateDynamic';
# save correct package settings
# for now there is no good way to retrieve them from cmake
gather sub {
my ( $build ) = @_;
my $prefix = $build->runtime_prop->{prefix};
$build->runtime_prop->{cflags} = "-I$prefix/include";
$build->runtime_prop->{cflags_static} = "-I$prefix/include";
my $extra_libs = ' -lm';
$extra_libs .= ' -lshlwapi' if $^O eq 'MSWin32';
$build->runtime_prop->{libs} = "-L$prefix/lib -ljq -lonig". $extra_libs;
$build->runtime_prop->{libs_static} = "-L$prefix/lib -ljq -lonig". $extra_libs;
};
};