Last active
January 8, 2020 11:02
-
-
Save zmughal/8264712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# See <http://perltricks.com/article/57/2014/1/1/Shazam-Use-Image-Magick-with-Perlbrew-in-minutes> | |
# may need to have the perl configured with -Duseshrplib | |
# | |
# perl -V | grep -- '-Duseshrplib' | |
# compile perl with perlbrew: | |
# | |
# perlbrew install $PERL_VERSION_HERE -D useshrplib | |
# | |
# may need to --force | |
# | |
# see <https://github.com/gugod/App-perlbrew/issues/131> | |
TOP="$HOME/local" | |
if [ -n "$1" ]; then | |
TOP=$1 | |
fi | |
mkdir -p $TOP | |
cd "$TOP" | |
wget -c http://www.imagemagick.org/download/ImageMagick.tar.gz | |
tar xzvf ImageMagick.tar.gz | |
cd ImageMagick* # this isn't exactly clean | |
PERL_CORE=$(perl -e 'print grep { -d } map { "$_/CORE" } @INC') | |
PERL_BIN=$(which perl) | |
PERL_THREADS=$(perl -V | grep -c 'useithreads=define') | |
THREAD_FLAG="--with-threads" | |
if [ $PERL_THREADS = 0 ]; then | |
THREAD_FLAG="--without-threads" | |
fi | |
LDFLAGS=-L$PERL_CORE \ | |
./configure --prefix $TOP \ | |
--with-perl=$PERL_BIN \ | |
--enable-shared $THREAD_FLAG | |
make install | |
# Test the install | |
# | |
# perl -MImage::Magick -E 'say ${"$Image::Magick::ISA[0]".::VERSION}' | |
# | |
# perl -MImage::Magick -e '$p = Image::Magick->new; $p->Read("magick:rose"); $p->Write("/tmp/test.png")'; display /tmp/test.png |
The link to Perltricks is now https://www.perl.com/article/57/2014/1/1/Shazam--Use-Image--Magick-with-Perlbrew-in-minutes/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context