Skip to content

Commit 3970db7

Browse files
committed
initial import
0 parents  commit 3970db7

File tree

10 files changed

+336
-0
lines changed

10 files changed

+336
-0
lines changed

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
!Build/
2+
.last_cover_stats
3+
/META.yml
4+
/META.json
5+
/MYMETA.*
6+
*.o
7+
*.pm.tdy
8+
*.bs
9+
10+
# Devel::Cover
11+
cover_db/
12+
13+
# Devel::NYTProf
14+
nytprof.out
15+
16+
# Dizt::Zilla
17+
/.build/
18+
19+
# Module::Build
20+
_build/
21+
Build
22+
Build.bat
23+
24+
# Module::Install
25+
inc/
26+
27+
# ExtUtils::MakeMaker
28+
/blib/
29+
/_eumm/
30+
/*.gz
31+
/Makefile
32+
/Makefile.old
33+
/MANIFEST.bak
34+
/pm_to_blib
35+
/*.zip
36+
37+
# Alien::Build
38+
/_alien/
39+
.vstags

Changes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Revision history for Perl module Alien::LibJQ
2+
3+
0.01 Sat Dec 19 15:25:00 2020
4+
- original version; created by ExtUtils::ModuleMaker 0.63
5+
6+

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
The MIT License
2+
3+
Copyright (c) <year> <copyright holders>
4+
5+
Permission is hereby granted, free of charge, to any person
6+
obtaining a copy of this software and associated
7+
documentation files (the "Software"), to deal in the Software
8+
without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense,
10+
and/or sell copies of the Software, and to permit persons to
11+
whom the Software is furnished to do so, subject to the
12+
following conditions:
13+
14+
The above copyright notice and this permission notice shall
15+
be included in all copies or substantial portions of the
16+
Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
19+
WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
20+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21+
MERCHANTABILITY, FITNESS FOR A PARTICULAR
22+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT
23+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27+
CONNECTION WITH THE SOFTWARE OR THE USE OR
28+
OTHER DEALINGS IN THE SOFTWARE.

MANIFEST

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
MANIFEST
2+
README
3+
LICENSE
4+
Todo
5+
Changes
6+
Makefile.PL
7+
lib/Alien/LibJQ.pm
8+
t/001_load.t

Makefile.PL

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
use ExtUtils::MakeMaker;
2+
use strict;
3+
use warnings;
4+
5+
use File::Spec;
6+
use Alien::Build;
7+
use Alien::Build::MM;
8+
9+
build_libonig();
10+
exit 0;
11+
12+
my $alien_build_version = '2.37';
13+
my $ext_makemaker_version = '7.46';
14+
15+
my %WriteMakefileArgs = (
16+
NAME => 'Alien::LibJQ',
17+
DISTNAME => 'Alien-LibJQ',
18+
VERSION_FROM => 'lib/Alien/LibJQ.pm',
19+
AUTHOR => 'Dongxu Ma (dongxu __at__ cpan.org)',
20+
ABSTRACT => 'Build libjq library (https://stedolan.github.io/jq/)',
21+
BUILD_REQUIRES => {
22+
'Alien::Build' => $alien_build_version,
23+
'ExtUtils::MakeMaker' => $ext_makemaker_version,
24+
( $^O eq 'MSWin32' ? ( 'Alien::cmake3' => '0.05' ) : ()),
25+
},
26+
CONFIGURE_REQUIRES => {
27+
'Alien::Build' => $alien_build_version,
28+
'ExtUtils::MakeMaker' => $ext_makemaker_version,
29+
'File::Spec' => 0,
30+
},
31+
# TEST_REQUIRES => {
32+
# 'Test2::V0' => 0,
33+
# 'Test::Alien' => 0,
34+
# },
35+
LICENSE => 'mit',
36+
MIN_PERL_VERSION => '5.008001',
37+
INSTALLDIRS => ($] < 5.011 ? 'perl' : 'site'),
38+
PREREQ_PM => {
39+
'Alien::Base' => $alien_build_version,
40+
},
41+
( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? () : ( META_MERGE => {
42+
'meta-spec' => { version => 2 },
43+
dynamic_config => 1,
44+
resources => {
45+
homepage => undef,
46+
repository => {
47+
url => 'git@github.com:dxma/perl5-cpan.git',
48+
web => 'https://github.com/dxma/perl5-cpan',
49+
type => 'git',
50+
},
51+
bugtracker => {
52+
web => 'https://github.com/dxma/perl5-cpan/issues',
53+
},
54+
},
55+
})),
56+
);
57+
58+
my $abmm = Alien::Build::MM->new;
59+
WriteMakefile($abmm->mm_args(%WriteMakefileArgs));
60+
61+
sub MY::postamble {
62+
$abmm->mm_postamble;
63+
}
64+
65+
sub build_libonig {
66+
my $build = Alien::Build->load('libonig.alienfile');
67+
my $prefix = File::Spec->catdir($build->root, 'install');
68+
return if -f File::Spec->catfile($prefix, 'lib', 'libonig.a');
69+
$build->load_requires('configure');
70+
$build->set_prefix($build);
71+
$build->set_stage($prefix);
72+
# for some reason, set_prefix doesn't work, set manually
73+
$build->install_prop->{prefix} = $prefix;
74+
$build->load_requires($build->install_type);
75+
$build->download;
76+
$build->build;
77+
}

README

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pod2text Alien::LibJQ.pm > README
2+
3+
If this is still here it means the programmer was too lazy to create the readme file.
4+
5+
You can create it now by using the command shown above from this directory.
6+
7+
At the very least you should be able to use this set of instructions
8+
to install the module...
9+
10+
perl Makefile.PL
11+
make
12+
make test
13+
make install
14+
15+
If you are on a windows box you should use 'nmake' rather than 'make'.

Todo

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
TODO list for Perl module Alien::LibJQ
2+
3+
- Nothing yet
4+
5+

lib/Alien/LibJQ.pm

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package Alien::LibJQ;
2+
use strict;
3+
use warnings;
4+
use base qw/Alien::Base/;
5+
use vars qw/$VERSION/;
6+
7+
$VERSION = '0.01';
8+
9+
=head1 NAME
10+
11+
Alien::LibJQ - Build libjq library (https://stedolan.github.io/jq/)
12+
13+
=head1 SYNOPSIS
14+
15+
In C<Makefile.PL>:
16+
use strict;
17+
use warnings;
18+
19+
use ExtUtils::MakeMaker;
20+
use Alien::Base::Wrapper;
21+
22+
...
23+
WriteMakefile(
24+
Alien::Base::Wrapper->new('Alien::LibJQ')->mm_args2(
25+
...
26+
CONFIGURE_REQUIRES => {
27+
...
28+
'Alien::LibJQ' => '0.01',
29+
...
30+
},
31+
...
32+
),
33+
);
34+
...
35+
36+
=head1 DESCRIPTION
37+
38+
Provide libjq.so to other modules.
39+
40+
=head1 AUTHOR
41+
42+
Dongxu Ma
43+
CPAN ID: DONGXU
44+
dongxu __at__ cpan.org
45+
https://github.com/dxma/perl5-cpan
46+
47+
=head1 COPYRIGHT
48+
49+
This program is free software licensed under the...
50+
51+
The MIT License
52+
53+
The full text of the license can be found in the
54+
LICENSE file included with this module.
55+
56+
57+
=head1 SEE ALSO
58+
59+
perl(1).
60+
61+
=cut
62+
63+
1;

libonig.alienfile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
use alienfile;
2+
3+
# check if installed as system package on Linux
4+
#plugin 'PkgConfig' => 'libonig5';
5+
6+
# verify it is GNU make
7+
#plugin 'Probe::CommandLine' => (
8+
# command => $_,
9+
# args => [ '--version' ],
10+
# match => qr/GNU Make/o,
11+
#) for qw/gmake make/;
12+
13+
# download utility available
14+
plugin 'Probe::CommandLine' => (
15+
command => 'curl',
16+
);
17+
plugin 'Probe::CommandLine' => (
18+
command => 'wget',
19+
secondary => 1,
20+
);
21+
22+
share {
23+
#start_url 'https://github.com/kkos/oniguruma/releases/';
24+
start_url 'https://hub.fastgit.org/kkos/oniguruma/releases/';
25+
plugin Download => (
26+
version => qr/^onig-([0-9\.]+)\.tar\.gz$/o,
27+
);
28+
plugin Extract => 'tar.gz';
29+
if ($^O eq 'MSWin32') {
30+
# #meta->prop->{env_interpolate} = 1;
31+
# #meta->prop->{env}->{ONIG_DIR} = '%{.install.extract}\\src';
32+
# #meta->prop->{env}->{BUILD_DIR} = '%{.install.extract}';
33+
# plugin 'Build::Make' => 'nmake';
34+
# build [
35+
# sub {
36+
# my ( $build, ) = @_;
37+
38+
# my $extract = $build->install_prop->{extract};
39+
# $extract =~ s#/#\\#go;
40+
# $ENV{ONIG_DIR} = $extract. '\\src';
41+
# $ENV{BUILD_DIR} = $extract;
42+
# $build->install_prop->{onig_dir} = $ENV{ONIG_DIR};
43+
# $build->install_prop->{build_dir}= $ENV{BUILD_DIR};
44+
# },
45+
# 'copy %{.install.onig_dir}\\config.h.windows.in %{.install.build_dir}\\config.h',
46+
# '%{make} -f %{.install.onig_dir}\\Makefile.windows',
47+
# ];
48+
plugin 'Build::CMake';
49+
# require Strawberry perl gmake.exe
50+
plugin 'Build::Make' => 'gmake';
51+
build [
52+
[ '%{cmake}', -G => '%{cmake_generator}',
53+
'-DCMAKE_MAKE_PROGRAM:PATH=%{make}',
54+
'-DBUILD_SHARED_LIBS:BOOL=OFF',
55+
'-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON',
56+
'-DCMAKE_INSTALL_PREFIX:PATH=%{.install.prefix}',
57+
'.'
58+
],
59+
'%{make}',
60+
'%{make} install',
61+
];
62+
}
63+
elsif ($^O eq 'MacOS') {
64+
# noop on Mac, jq compile will build this module
65+
}
66+
else {
67+
build [
68+
'%{sh} configure --disable-shared --with-pic --prefix=%{.install.prefix}',
69+
'%{make}',
70+
'%{make} install',
71+
];
72+
}
73+
plugin 'Gather::IsolateDynamic';
74+
# gather sub {
75+
# my ( $build, ) = @_;
76+
77+
# my $prefix = $build->runtime_prop->{prefix};
78+
# $build->runtime_prop->{cflags} = "-I$prefix/include";
79+
# $build->runtime_prop->{cflags_static} = "-I$prefix/include";
80+
# $build->runtime_prop->{libs} = "-L$prefix/lib -lonig5";
81+
# $build->runtime_prop->{libs_static} = "-L$prefix/lib -lonig5";
82+
# };
83+
};

t/001_load.t

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# -*- perl -*-
2+
3+
# t/001_load.t - check module loading and create testing directory
4+
5+
use Test::More tests => 2;
6+
7+
BEGIN { use_ok( 'Alien::LibJQ' ); }
8+
9+
my $object = Alien::LibJQ->new ();
10+
isa_ok ($object, 'Alien::LibJQ');
11+
12+

0 commit comments

Comments
 (0)