From bcb2e9425d9e1b08a5fc02a11f23103da65df5bf Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Sun, 29 Oct 2023 16:01:51 -0400 Subject: [PATCH 01/18] Add GHA CI --- .github/workflows/ci.yml | 158 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..60c7cd2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,158 @@ +name: Run Tests + +on: + push: + branches: + - '*' + pull_request: + +env: + PKG_NAME: Sord + PKG_UBUNTU: libsord-dev + PKG_HOMEBREW: sord + PKG_MSYS2_MINGW64: mingw-w64-x86_64-sord + PKG_MSYS2_MINGW64_DEPS: >- + base-devel + unzip + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-perl + mingw-w64-x86_64-curl + mingw-w64-x86_64-meson + mingw-w64-x86_64-ninja + mingw-w64-x86_64-pkg-config + +jobs: + dist: + name: Make distribution using Dist::Zilla + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Cache ~/perl5 + uses: actions/cache@v3 + with: + key: ${{ runner.os }}-dist-locallib + path: ~/perl5 + - name: Perl version + run: | + perl -v + - name: Install cpanm + run: | + curl -L https://cpanmin.us | perl - --sudo App::cpanminus + - name: Install local::lib + run: | + cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) + - name: Install Dist::Zilla + shell: bash + run: | + eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) + cpanm -n Dist::Zilla + dzil authordeps --missing | cpanm -n + - name: Make distribution + shell: bash + run: | + eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) + dzil build --in build-dir + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: dist + path: ./build-dir + test: + needs: dist + runs-on: ${{ matrix.os }} + defaults: + run: + # bash on macos and linux + # powershell on windows + strawberry perl + # msys2 {0} on windows + msys2 + shell: >- + ${{ fromJSON( '["", "bash {0}"]' )[ startsWith(matrix.os, 'ubuntu-' ) || startsWith(matrix.os, 'macos-') ] + }}${{ fromJSON( '["", "powershell {0}"]' )[ startsWith(matrix.os, 'windows-') && matrix.dist == 'strawberry' ] + }}${{ fromJSON( '["", "msys2 {0}"]' )[ startsWith(matrix.os, 'windows-') && matrix.dist == 'msys2' ] }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + perl-version: ['5.8', '5.20', '5.30', '5.34'] + alien-install-type: [ 'system', 'share' ] + include: + # Windows strawberry | share + - { perl-version: '5.34' , os: windows-latest , dist: strawberry , alien-install-type: 'share' } + # Windows msys2 | system, share + - { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'system' } + - { perl-version: '5.34' , os: windows-latest , dist: msys2 , alien-install-type: 'share' } + # macOS | system, share + - { perl-version: '5.34' , os: macos-11 , alien-install-type: 'system' } + - { perl-version: '5.34' , os: macos-11 , alien-install-type: 'share' } + name: Perl ${{ matrix.perl-version }} on ${{ matrix.os }} with install-type ${{ matrix.alien-install-type }}, dist ${{ matrix.dist }} + + steps: + - name: Get dist artifact + uses: actions/download-artifact@v3 + with: + name: dist + + # Setup system package + - name: Setup system ${{ env.PKG_NAME }} (apt) + if: runner.os == 'Linux' && matrix.alien-install-type == 'system' + run: | + sudo apt-get -y update && sudo apt-get install -y ${{ env.PKG_UBUNTU }} + - name: Setup system ${{ env.PKG_NAME }} (homebrew) + if: runner.os == 'macOS' && matrix.alien-install-type == 'system' + run: | + brew install ${{ env.PKG_HOMEBREW }} + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 + if: runner.os == 'Windows' && matrix.dist == 'msys2' + with: + update: true + install: ${{ env.PKG_MSYS2_MINGW64_DEPS }} + - name: Set up ${{ env.PKG_NAME }} (MSYS2/MinGW pacman) + if: runner.os == 'Windows' && matrix.dist == 'msys2' && matrix.alien-install-type == 'system' + shell: msys2 {0} + run: | + pacman -S --needed --noconfirm ${{ env.PKG_MSYS2_MINGW64 }} + + # Setup Perl + - name: Set up perl + uses: shogo82148/actions-setup-perl@v1 + if: runner.os != 'Windows' + with: + perl-version: ${{ matrix.perl-version }} + - name: Set up perl (Strawberry) + uses: shogo82148/actions-setup-perl@v1 + if: runner.os == 'Windows' && matrix.dist == 'strawberry' + with: + distribution: 'strawberry' + + - run: perl -V + - name: Install cpanm + if: runner.os == 'Windows' && matrix.dist == 'msys2' + run: + yes | cpan -T App::cpanminus || true + + - name: Install Perl deps + run: | + cpanm --notest --installdeps . + + - name: Install share install deps before setting ALIEN_INSTALL_TYPE + if: matrix.alien-install-type == 'share' + run: | + cpanm --notest Alien::Meson Alien::Ninja Net::SSLeay IO::Socket::SSL + + - name: Set ALIEN_INSTALL_TYPE + shell: bash + run: | + echo "ALIEN_INSTALL_TYPE=${{ matrix.alien-install-type }}" >> $GITHUB_ENV + + - name: Set ALIEN_BUILD_PKG_CONFIG + if: runner.os == 'Windows' && matrix.dist == 'msys2' + run: | + echo "ALIEN_BUILD_PKG_CONFIG=PkgConfig::CommandLine" >> $GITHUB_ENV + + - name: Run tests + env: + ALIEN_BUILD_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cpanm --verbose --test-only . From d6dd3ef1d24cec717c6a2677b29029cd6861f0ac Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Sun, 29 Oct 2023 16:04:27 -0400 Subject: [PATCH 02/18] Improve dzil config --- dist.ini | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dist.ini b/dist.ini index 848e4bd..92eae2b 100644 --- a/dist.ini +++ b/dist.ini @@ -6,7 +6,25 @@ copyright_year = 2023 version = 0.01 -[@Starter] -revision = 5 +; has to come before Git::Commit +[NextRelease] +[PkgVersion] +[@Starter::Git] +revision = 5 +[AutoPrereqs] [AlienBuild] +; authordep Alien::Build::Plugin::Download::GitLab +[CheckChangesHasContent] +[GithubMeta] +issues = 1 +[ReadmeAnyFromPod] +type = markdown +location = root +filename = README.md +phase = release +[Regenerate::AfterReleasers] +plugin = ReadmeAnyFromPod + +[MetaResources] +x_IRC = irc://irc.perl.org/#perlrdf From d84d13c3cafa647cbf60b063d33f578712833ea6 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Sun, 29 Oct 2023 16:16:14 -0400 Subject: [PATCH 03/18] Improve Meson and linking --- alienfile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/alienfile b/alienfile index e102333..7088eee 100644 --- a/alienfile +++ b/alienfile @@ -3,7 +3,6 @@ use alienfile; plugin PkgConfig => 'sord-0'; share { - requires 'Alien::Build::Plugin::Gather::Dino'; requires 'Alien::Build::Plugin::Download::GitLab'; requires 'Alien::Meson'; requires 'Alien::Ninja'; @@ -17,15 +16,27 @@ share { my $build_dir = '_build'; build [ - [ '%{meson}', 'setup', - '--prefix=%{.install.prefix}', - '--libdir=lib', - '--buildtype=release', - '-Ddocs=disabled', # no docs - $build_dir ], + sub { + my $build = shift; + Alien::Build::CommandSequence->new([ + Alien::Meson->exe, 'setup', + ( + $^O ne 'MSWin32' + ? ( '-Ddefault_library=both', ) # both static and shared + : () + ), + '--prefix=%{.install.prefix}', + '--libdir=lib', + '--buildtype=release', + '-Ddocs=disabled', # no docs + $build_dir, + ])->execute($build); + }, [ '%{ninja}', qw(-C), $build_dir, "test" ], [ '%{ninja}', qw(-C), $build_dir, 'install' ], ]; - plugin 'Gather::Dino'; + if( $^O ne 'MSWin32' ) { + plugin 'Gather::IsolateDynamic'; + } } From 8c59168c2158a8b41a993fdc79df0834caf50a95 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Sun, 29 Oct 2023 16:16:23 -0400 Subject: [PATCH 04/18] Add URL --- alienfile | 1 + 1 file changed, 1 insertion(+) diff --git a/alienfile b/alienfile index 7088eee..283c182 100644 --- a/alienfile +++ b/alienfile @@ -7,6 +7,7 @@ share { requires 'Alien::Meson'; requires 'Alien::Ninja'; + # https://gitlab.com/drobilla/sord plugin 'Download::GitLab' => ( gitlab_user => 'drobilla', gitlab_project => 'sord', From e64390e407cfa8b9201df4ac75a44865376f70e4 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Tue, 7 Nov 2023 01:41:49 -0500 Subject: [PATCH 05/18] Add dependency on Alien::zix --- alienfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/alienfile b/alienfile index 283c182..4c57831 100644 --- a/alienfile +++ b/alienfile @@ -1,5 +1,8 @@ use alienfile; +use Env qw(@PKG_CONFIG_PATH); +requires 'Alien::zix'; + plugin PkgConfig => 'sord-0'; share { @@ -15,6 +18,11 @@ share { plugin Extract => 'tar.gz'; + eval { + require Alien::zix; + push @PKG_CONFIG_PATH, Alien::zix->pkg_config_path; + } or warn "Unable to add to \$PKG_CONFIG_PATH (@PKG_CONFIG_PATH): $@"; + my $build_dir = '_build'; build [ sub { From f822b0d45c1ef3dc80dfbf6157a2c9e955f88a39 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Tue, 7 Nov 2023 01:42:04 -0500 Subject: [PATCH 06/18] Set DESTDIR --- alienfile | 1 + 1 file changed, 1 insertion(+) diff --git a/alienfile b/alienfile index 4c57831..037ade4 100644 --- a/alienfile +++ b/alienfile @@ -23,6 +23,7 @@ share { push @PKG_CONFIG_PATH, Alien::zix->pkg_config_path; } or warn "Unable to add to \$PKG_CONFIG_PATH (@PKG_CONFIG_PATH): $@"; + meta->prop->{destdir} = 1; my $build_dir = '_build'; build [ sub { From a8e2fda3eb884eb4cbf6cb87fe8f0e42108cc176 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Wed, 8 Nov 2023 23:41:00 -0500 Subject: [PATCH 07/18] Add Meson DESTDIR workaround --- alienfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/alienfile b/alienfile index 037ade4..2aa0233 100644 --- a/alienfile +++ b/alienfile @@ -5,9 +5,14 @@ requires 'Alien::zix'; plugin PkgConfig => 'sord-0'; +eval { + require Alien::Meson; + Alien::Meson->_apply_destdir_prefix_hack; +}; + share { requires 'Alien::Build::Plugin::Download::GitLab'; - requires 'Alien::Meson'; + requires 'Alien::Meson' => '0.06'; requires 'Alien::Ninja'; # https://gitlab.com/drobilla/sord From fefccd80edd5429f1786a0b963d251fdc05665ec Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Thu, 9 Nov 2023 00:10:44 -0500 Subject: [PATCH 08/18] Add dependency on Alien::Serd --- alienfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alienfile b/alienfile index 2aa0233..9ad7069 100644 --- a/alienfile +++ b/alienfile @@ -2,6 +2,7 @@ use alienfile; use Env qw(@PKG_CONFIG_PATH); requires 'Alien::zix'; +requires 'Alien::Serd'; plugin PkgConfig => 'sord-0'; @@ -25,7 +26,9 @@ share { eval { require Alien::zix; - push @PKG_CONFIG_PATH, Alien::zix->pkg_config_path; + require Alien::Serd; + push @PKG_CONFIG_PATH, map { $_->pkg_config_path } + qw(Alien::zix Alien::Serd); } or warn "Unable to add to \$PKG_CONFIG_PATH (@PKG_CONFIG_PATH): $@"; meta->prop->{destdir} = 1; From ec8aec160e95622f21b70d5306e1630546229da9 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Thu, 9 Nov 2023 00:34:09 -0500 Subject: [PATCH 09/18] Add XS and FFI tests --- t/alien_sord.t | 67 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/t/alien_sord.t b/t/alien_sord.t index e966466..eb42bf4 100644 --- a/t/alien_sord.t +++ b/t/alien_sord.t @@ -6,27 +6,50 @@ use Alien::Sord; alien_diag 'Alien::Sord'; alien_ok 'Alien::Sord'; -# run_ok([ ... ]) -# ->success -# ->out_like(qr/ ... /); - -# my $xs = <<'END'; -# #include "EXTERN.h" -# #include "perl.h" -# #include "XSUB.h" -# ... -# -# MODULE = main PACKAGE = main -# -# ... -# END -# xs_ok $xs, with_subtest { -# ... -# }; - -# ffi_ok { symbols => [...] }, with_subtest { -# my $ffi = shift; -# ... -# }; +# NOTE Disable tool for now +#if( which 'sordi' ) { +# run_ok([ qw(sordi --version) ]) +# ->success +# ->out_like(qr/sordi\s+([0-9.]+)/); +#} + +my $xs = <<'END'; +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#include "sord/sord.h" + +bool test( const char* class ) { + SordWorld* world = sord_world_new(); + SordNode* uri_a = sord_new_uri(world, "http://example.com/"); + SordNode* uri_b = sord_new_uri(world, "http://example.com/"); + return sord_node_equals(uri_a, uri_b); +} + +MODULE = main PACKAGE = main + +bool test(class) + const char* class + +END +xs_ok $xs, with_subtest { + my ($module) = @_; + ok $module->test, 'URIs are equal'; +}; + +ffi_ok { symbols => [ qw(sord_world_new sord_new_uri sord_node_equals) ] }, with_subtest { + my $ffi = shift; + $ffi->type( 'opaque' => 'SordWorld' ); + $ffi->type( 'opaque' => 'SordNode' ); + my $World_new = $ffi->function( sord_world_new => [] => 'SordWorld' ); + my $Node_new_uri = $ffi->function( sord_new_uri => ['SordWorld', 'string'] => 'SordNode' ); + my $Node_equals = $ffi->function( sord_node_equals => ['SordNode', 'SordNode'] => 'bool' ); + + my $world = $World_new->(); + my $uri_a = $Node_new_uri->($world, 'http://example.com/'); + my $uri_b = $Node_new_uri->($world, 'http://example.com/'); + ok $Node_equals->($uri_a, $uri_b), 'URIs are equal'; +}; done_testing; From f5b271107b7d15f4f96a4d55368b09510c824a86 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Thu, 9 Nov 2023 13:51:38 -0500 Subject: [PATCH 10/18] Use perlrdf shared actions --- .github/workflows/ci.yml | 61 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60c7cd2..1564023 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,14 @@ name: Run Tests on: + workflow_dispatch: push: branches: - '*' + tags-ignore: + - '*' pull_request: + create: env: PKG_NAME: Sord @@ -22,44 +26,29 @@ env: mingw-w64-x86_64-pkg-config jobs: + notify: + runs-on: ubuntu-latest + continue-on-error: true + if: ${{ always() }} + steps: + - uses: perlrdf/devops/github-actions/irc-notifications@main + with: + target-notifications: true dist: - name: Make distribution using Dist::Zilla + if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} + name: Make distribution runs-on: ubuntu-latest + outputs: + min-perl-version: ${{ steps.build-dist.outputs.min-perl-version }} steps: - name: Checkout code uses: actions/checkout@v3 - - name: Cache ~/perl5 - uses: actions/cache@v3 + - id: build-dist + uses: perlrdf/devops/github-actions/build-dist@main with: - key: ${{ runner.os }}-dist-locallib - path: ~/perl5 - - name: Perl version - run: | - perl -v - - name: Install cpanm - run: | - curl -L https://cpanmin.us | perl - --sudo App::cpanminus - - name: Install local::lib - run: | - cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) - - name: Install Dist::Zilla - shell: bash - run: | - eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) - cpanm -n Dist::Zilla - dzil authordeps --missing | cpanm -n - - name: Make distribution - shell: bash - run: | - eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) - dzil build --in build-dir - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: dist - path: ./build-dir + dist-perl-deps-develop: strict # Add modules test: - needs: dist + needs: [ 'dist', 'notify' ] runs-on: ${{ matrix.os }} defaults: run: @@ -156,3 +145,13 @@ jobs: ALIEN_BUILD_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cpanm --verbose --test-only . + build-status: + runs-on: ubuntu-latest + continue-on-error: true + if: ${{ always() }} + needs: test + steps: + - uses: perlrdf/devops/github-actions/irc-notifications@main + with: + target-build-status: true + needs: ${{ toJSON(needs) }} From bc7cc66088e7e9097246c388570731ad44a929b9 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Thu, 9 Nov 2023 14:36:09 -0500 Subject: [PATCH 11/18] CI: Add Alien::zix Alien::Serd --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1564023..70f2779 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: - name: Install share install deps before setting ALIEN_INSTALL_TYPE if: matrix.alien-install-type == 'share' run: | - cpanm --notest Alien::Meson Alien::Ninja Net::SSLeay IO::Socket::SSL + cpanm --notest Alien::Meson Alien::Ninja Net::SSLeay IO::Socket::SSL Alien::zix Alien::Serd - name: Set ALIEN_INSTALL_TYPE shell: bash From 51e0920b21b6baf92830e353b4a907869719e7bf Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Thu, 9 Nov 2023 14:36:41 -0500 Subject: [PATCH 12/18] CI: install pkg-config-lite for Strawberry This is needed because Meson skips the Pure Perl `pkg-config.bat` provided by Strawberry Perl. Connects with: - - --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70f2779..4fb4085 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,6 +114,11 @@ jobs: if: runner.os == 'Windows' && matrix.dist == 'strawberry' with: distribution: 'strawberry' + - name: Set up pkg-config-lite (Strawberry) + if: runner.os == 'Windows' && matrix.dist == 'strawberry' && matrix.alien-install-type == 'share' + run: | + choco install pkgconfiglite + echo "C:\ProgramData\chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - run: perl -V - name: Install cpanm From f571afc943aa8e316e279c1fe4a518f73a4ce144 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Thu, 9 Nov 2023 15:18:02 -0500 Subject: [PATCH 13/18] Add README.md --- README.md | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..fa402f7 --- /dev/null +++ b/README.md @@ -0,0 +1,96 @@ +# NAME + +Alien::Sord - Find or build Sord in-memory RDF store + +# SYNOPSIS + +From [ExtUtils::MakeMaker](https://metacpan.org/pod/ExtUtils%3A%3AMakeMaker): + + use ExtUtils::MakeMaker; + use Alien::Base::Wrapper (); + + WriteMakefile( + Alien::Base::Wrapper->new('Alien::Sord')->mm_args2( + NAME => 'FOO::XS', + ... + ), + ); + +From [Module::Build](https://metacpan.org/pod/Module%3A%3ABuild): + + use Module::Build; + use Alien::Base::Wrapper qw( Alien::Sord !export ); + use Alien::Sord; + + my $build = Module::Build->new( + ... + configure_requires => { + 'Alien::Base::Wrapper' => '0', + 'Alien::Sord' => '0', + ... + }, + Alien::Base::Wrapper->mb_args, + ... + ); + + $build->create_build_script; + +From [Inline::C](https://metacpan.org/pod/Inline%3A%3AC) / [Inline::CPP](https://metacpan.org/pod/Inline%3A%3ACPP) script: + + use Inline 0.56 with => 'Alien::Sord'; + +From [Dist::Zilla](https://metacpan.org/pod/Dist%3A%3AZilla) + + [@Filter] + -bundle = @Basic + -remove = MakeMaker + + [Prereqs / ConfigureRequires] + Alien::Sord = 0 + + [MakeMaker::Awesome] + header = use Alien::Base::Wrapper qw( Alien::Sord !export ); + WriteMakefile_arg = Alien::Base::Wrapper->mm_args + +From [FFI::Platypus](https://metacpan.org/pod/FFI%3A%3APlatypus): + + use FFI::Platypus; + use Alien::Sord; + + my $ffi = FFI::Platypus->new( + lib => [ Alien::Sord->dynamic_libs ], + ); + +Command line tool: + + use Alien::Sord; + use Env qw( @PATH ); + + unshift @PATH, Alien::Sord->bin_dir; + +# DESCRIPTION + +This distribution provides Sord so that it can be used by other +Perl distributions that are on CPAN. It does this by first trying to +detect an existing install of Sord on your system. If found it +will use that. If it cannot be found, the source code will be downloaded +from the internet and it will be installed in a private share location +for the use of other modules. + +# SEE ALSO + +- [Sord](https://drobilla.net/software/sord.html) + + Sord homepage. + +- [Alien](https://metacpan.org/pod/Alien) + + Documentation on the Alien concept itself. + +- [Alien::Base](https://metacpan.org/pod/Alien%3A%3ABase) + + The base class for this Alien. + +- [Alien::Build::Manual::AlienUser](https://metacpan.org/pod/Alien%3A%3ABuild%3A%3AManual%3A%3AAlienUser) + + Detailed manual for users of Alien classes. From ce024be50c0b731d88e0872aa1095bb7f3e53e2b Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Thu, 9 Nov 2023 15:31:38 -0500 Subject: [PATCH 14/18] Build static and shared --- alienfile | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/alienfile b/alienfile index 9ad7069..13e7360 100644 --- a/alienfile +++ b/alienfile @@ -38,11 +38,7 @@ share { my $build = shift; Alien::Build::CommandSequence->new([ Alien::Meson->exe, 'setup', - ( - $^O ne 'MSWin32' - ? ( '-Ddefault_library=both', ) # both static and shared - : () - ), + '-Ddefault_library=static', '--prefix=%{.install.prefix}', '--libdir=lib', '--buildtype=release', @@ -54,7 +50,24 @@ share { [ '%{ninja}', qw(-C), $build_dir, 'install' ], ]; - if( $^O ne 'MSWin32' ) { - plugin 'Gather::IsolateDynamic'; - } + ffi { + build [ + sub { + my $build = shift; + Alien::Build::CommandSequence->new([ + Alien::Meson->exe, 'setup', + '-Ddefault_library=shared', + '--prefix=%{.install.prefix}', + '--libdir=lib', + '--buildtype=release', + '-Ddocs=disabled', # no docs + $build_dir, + ])->execute($build); + }, + [ '%{ninja}', qw(-C), $build_dir, "test" ], + [ '%{ninja}', qw(-C), $build_dir, 'install' ], + ]; + }; + + plugin 'Gather::IsolateDynamic'; } From 7e78f1cee9f27e61f7f2153b49064e1f03adb9fb Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Sat, 11 Nov 2023 19:36:43 -0500 Subject: [PATCH 15/18] Improve creating static and dynamic libraries --- alienfile | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/alienfile b/alienfile index 13e7360..381d606 100644 --- a/alienfile +++ b/alienfile @@ -34,40 +34,24 @@ share { meta->prop->{destdir} = 1; my $build_dir = '_build'; build [ - sub { - my $build = shift; - Alien::Build::CommandSequence->new([ - Alien::Meson->exe, 'setup', - '-Ddefault_library=static', - '--prefix=%{.install.prefix}', - '--libdir=lib', - '--buildtype=release', - '-Ddocs=disabled', # no docs - $build_dir, - ])->execute($build); - }, - [ '%{ninja}', qw(-C), $build_dir, "test" ], - [ '%{ninja}', qw(-C), $build_dir, 'install' ], - ]; - - ffi { - build [ + map { + my $linkage = $_; ( sub { my $build = shift; Alien::Build::CommandSequence->new([ Alien::Meson->exe, 'setup', - '-Ddefault_library=shared', + "-Ddefault_library=$linkage", '--prefix=%{.install.prefix}', '--libdir=lib', '--buildtype=release', '-Ddocs=disabled', # no docs - $build_dir, + "${build_dir}_$linkage", ])->execute($build); }, - [ '%{ninja}', qw(-C), $build_dir, "test" ], - [ '%{ninja}', qw(-C), $build_dir, 'install' ], - ]; - }; + [ '%{ninja}', qw(-C), "${build_dir}_$linkage", "test" ], + [ '%{ninja}', qw(-C), "${build_dir}_$linkage", 'install' ], + ) } qw(shared static) + ]; plugin 'Gather::IsolateDynamic'; } From 3399e42658e5584ce64ba9e7a441857b93b03633 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Sat, 11 Nov 2023 19:37:05 -0500 Subject: [PATCH 16/18] Enable testing of tool --- t/alien_sord.t | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/t/alien_sord.t b/t/alien_sord.t index eb42bf4..2d8c6fb 100644 --- a/t/alien_sord.t +++ b/t/alien_sord.t @@ -2,16 +2,16 @@ use Test2::V0; use Test::Alien; use Test::Alien::Diag; use Alien::Sord; +use File::Which; alien_diag 'Alien::Sord'; alien_ok 'Alien::Sord'; -# NOTE Disable tool for now -#if( which 'sordi' ) { -# run_ok([ qw(sordi --version) ]) -# ->success -# ->out_like(qr/sordi\s+([0-9.]+)/); -#} +if( which 'sordi' ) { + run_ok([ qw(sordi -v) ]) + ->success + ->out_like(qr/sordi\s+([0-9.]+)/); +} my $xs = <<'END'; #include "EXTERN.h" From 51a3ad4cbf08e6bfb9195e7013456f172abebb92 Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Sat, 11 Nov 2023 20:21:50 -0500 Subject: [PATCH 17/18] GHA: Bump min Perl version to test to 5.14 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fb4085..b3429dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - perl-version: ['5.8', '5.20', '5.30', '5.34'] + perl-version: ['5.14', '5.20', '5.30', '5.34'] alien-install-type: [ 'system', 'share' ] include: # Windows strawberry | share From c927157ff1dd3ef823ae83e5782e562572be37be Mon Sep 17 00:00:00 2001 From: Zakariyya Mughal Date: Sat, 11 Nov 2023 20:39:53 -0500 Subject: [PATCH 18/18] GHA: Add --allow-empty-checksums to Chocolatey --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3429dd..c4bf403 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,7 +117,7 @@ jobs: - name: Set up pkg-config-lite (Strawberry) if: runner.os == 'Windows' && matrix.dist == 'strawberry' && matrix.alien-install-type == 'share' run: | - choco install pkgconfiglite + choco install -y --allow-empty-checksums pkgconfiglite echo "C:\ProgramData\chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - run: perl -V