| 1 | 1 | ▶ | use alienfile; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | # Alien::TinyCDB build recipe (Alien::Build path). | ||
| 4 | # | ||
| 5 | # Provides Michael Tokarev's TinyCDB (corpit.ru cdb) C library to Perl | ||
| 6 | # consumers through cflags / libs / dynamic_libs. Probe for a usable system | ||
| 7 | # install first; otherwise fetch upstream and build from source. | ||
| 8 | |||
| 9 | # System detection: upstream's `make install` ships a pkg-config file | ||
| 10 | # (libcdb.pc), so pkg-config is the honest probe + sys gather. If a usable | ||
| 11 | # system TinyCDB is found the share block below is skipped entirely. | ||
| 12 | 1 | plugin 'PkgConfig' => ( | |
| 13 | pkg_name => 'libcdb', | ||
| 14 | ); | ||
| 15 | |||
| 16 | 1 | ▶ | share { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.6
| |||
| 17 | |||
| 18 | # Upstream is fetched at build time, not vendored, and the version is NOT | ||
| 19 | # pinned: pick the newest tinycdb-<version>.tar.gz the directory lists. | ||
| 20 | # This mirrors the previous Alien::Base::ModuleBuild alien_pattern_* keys | ||
| 21 | # (prefix tinycdb-, version ([\d.]+), suffix \.tar\.gz) against alien_repo. | ||
| 22 | 1 | start_url 'http://www.corpit.ru/mjt/tinycdb/'; | |
| 23 | 1 | plugin 'Download' => ( | |
| 24 | filter => qr/^tinycdb-[0-9\.]+\.tar\.gz$/, | ||
| 25 | version => qr/^tinycdb-([0-9\.]+)\.tar\.gz$/, | ||
| 26 | ); | ||
| 27 | 1 | plugin 'Extract' => 'tar.gz'; | |
| 28 | |||
| 29 | # TinyCDB ships a plain hand-written Makefile (no ./configure). Its default | ||
| 30 | # `all: static` target builds only the static libcdb.a plus the cdb binary; | ||
| 31 | # the shared library lives behind the separate `sharedlib` (build) and | ||
| 32 | # `install-sharedlib` (install) targets, which upstream marks GNU CC/LD | ||
| 33 | # specific (-fPIC / -shared). Build and install BOTH the static archive and | ||
| 34 | # the shared object, so that ->libs links libcdb.a and ->dynamic_libs finds | ||
| 35 | # libcdb.so for FFI::Platypus. %s-style prefix is supplied by Alien::Build | ||
| 36 | # as the staging install prefix; never hardcode a path. | ||
| 37 | 1 | build [ | |
| 38 | '%{make} prefix=%{.install.prefix} static sharedlib', | ||
| 39 | '%{make} prefix=%{.install.prefix} install install-sharedlib', | ||
| 40 | ]; | ||
| 41 | |||
| 42 | # Move the shared libraries into their own dynamic/ directory, keeping | ||
| 43 | # ->libs (static link against libcdb.a) and ->dynamic_libs (the .so, for | ||
| 44 | # FFI) cleanly separate. | ||
| 45 | 1 | plugin 'Gather::IsolateDynamic'; | |
| 46 | |||
| 47 | # Gather the consumer flags from the staging prefix. Alien::Base rewrites | ||
| 48 | # the staging prefix to the final dist_dir at runtime (see Alien::Base | ||
| 49 | # _flags relocation), so these stay correct after install. | ||
| 50 | 0 | ▶ | gather sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 51 | 0 | my ($build) = @_; | |
| 52 | 0 | my $prefix = $build->runtime_prop->{prefix}; | |
| 53 | 0 | $build->runtime_prop->{cflags} = "-I$prefix/include"; | |
| 54 | 0 | $build->runtime_prop->{libs} = "-L$prefix/lib -lcdb"; | |
| 55 | 1 | }; | |
| 56 | |||
| 57 | 1 | }; | |