Skip to content

Instantly share code, notes, and snippets.

@bombsimon
Last active September 12, 2019 19:09
Show Gist options
  • Save bombsimon/9379976c55c7c91f5d28b06272dd9622 to your computer and use it in GitHub Desktop.
Save bombsimon/9379976c55c7c91f5d28b06272dd9622 to your computer and use it in GitHub Desktop.
Perl package require special handling

CPAN modules and macOS

Image::Magick

# Install version 6 of imagemagick to comply with Magick.xs
brew install imagemagick@6 --with-perl

# Create links so make can find C libraries.
# imagemagick@6 is keg-only and must be linked with --force
brew link imagemagick@6 --force

# Install the perl package, required -n (no test) for me
cpanm Image::Magick -n

# Verify installation
perl -MImage::Magick -E 'say Image::Magick->QuantumDepth'
16

Crypt::SSLeay / Crypt::OpenSSL::X509

brew install openssl

# Either pass install args
cpanm  --configure-args="--libpath='/usr/local/opt/openssl/lib' --incpath='/usr/local/opt/openssl/include/'" Crypt::SSLeay

# Or use environment variables
C_INCLUDE_PATH="/usr/local/opt/openssl/include" cpanm Crypt::OpenSSL::VerifyX509

Perl::LanguageServer

According to documentation requires GitHub version of Compiler::Lexer since the one on CPAN is buggy. Sadly the bundled version from Perl::LanguageServer isn't working properly on macOS either so we need to build from GitHub repository and remove the bundled verion to avoid re-building.

# Clone respository
git clone git@github.com:goccy/p5-Compiler-Lexer.git && cd p5-Compiler-Lexer

# Install manually
cpanm .

# Pull Perl::LanguageServer
wget https://cpan.metacpan.org/authors/id/G/GR/GRICHTER/Perl-LanguageServer-0.9.tar.gz

# Unpack
tar zxf Perl-LanguageServer-0.9.tar.gz && cd Perl-LanguageServer-0.9

# Remove the bundled Compiler::Lexer and install
rm -fr p5-Compiler-Lexer
cpanm .

XML::LibXML

Since macOS 10.14 brew won't link packages and libraries bundlede with macOS. This includes libxml2 and it's header files.

# Install libxml2
brew install libxml2

# Set correct config path and install XML::LibXML
PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig" cpanm XML::LibXML
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment