|
| 1 | +use alienfile; |
| 2 | + |
| 3 | +use File::Spec::Functions qw/catfile/; |
| 4 | + |
| 5 | +# download utility available |
| 6 | +plugin 'Probe::CommandLine' => ( |
| 7 | + command => 'curl', |
| 8 | +); |
| 9 | +plugin 'Probe::CommandLine' => ( |
| 10 | + command => 'wget', |
| 11 | + secondary => 1, |
| 12 | +); |
| 13 | + |
| 14 | +share { |
| 15 | + #start_url 'https://github.com/stedolan/jq/releases/'; |
| 16 | + # china mirror |
| 17 | + start_url 'https://hub.fastgit.org/stedolan/jq/releases/'; |
| 18 | + plugin Download => ( |
| 19 | + version => qr/^jq-([0-9\.]+)\.tar\.gz$/o, |
| 20 | + ); |
| 21 | + plugin Extract => 'tar.gz'; |
| 22 | + plugin 'Build::CMake'; |
| 23 | + # require Strawberry perl gmake.exe on windows |
| 24 | + plugin 'Build::Make' => ( $^O eq 'MSWin32' ? 'gmake' : 'make' ); |
| 25 | + build [ |
| 26 | + # pitch in required cmake stuff |
| 27 | + 'echo %cd%', |
| 28 | + [ '%{cp}', catfile('..', '..', '..', 'jq', 'scripts', 'gen_builtin_inc.pl'), 'scripts' ], |
| 29 | + [ '%{cp}', catfile('..', '..', '..', 'jq', 'src', 'setenv.h'), 'src' ], |
| 30 | + [ '%{cp}', catfile('..', '..', '..', 'jq', 'src', 'setenv.c'), 'src' ], |
| 31 | + [ '%{cp}', catfile('..', '..', '..', 'jq', 'builtin.c.patch'), '.' ], |
| 32 | + [ '%{cp}', catfile('..', '..', '..', 'jq', 'CMakeLists.txt'), '.' ], |
| 33 | + [ '%{cp}', catfile('..', '..', '..', 'jq', 'Config.cmake.in'), '.' ], |
| 34 | + [ '%{cp}', catfile('..', '..', '..', 'jq', 'dist.info'), '.' ], |
| 35 | + [ '%{cp}', catfile('..', '..', '..', 'jq', 'jq.pc.cmake.in'), '.' ], |
| 36 | + # execute cmake build |
| 37 | + [ '%{cmake}', -G => '%{cmake_generator}', ( $^O eq 'MSWin32' ? '-DCMAKE_MAKE_PROGRAM=%{make}' : () ), |
| 38 | + '-DBUILD_SHARED_LIBS=OFF', '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', |
| 39 | + '-DENABLE_MAINTAINER_MODE=OFF', '-DWITH_ONIGURUMA=builtin', |
| 40 | + '-DCMAKE_INSTALL_PREFIX=%{.install.prefix}', |
| 41 | + '.' |
| 42 | + ], |
| 43 | + '%{make}', |
| 44 | + '%{make} install', |
| 45 | + ]; |
| 46 | + plugin 'Gather::IsolateDynamic'; |
| 47 | +}; |
0 commit comments