mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Ensure support for more Linux flavours
Add docker-based packaging tests
This commit is contained in:
parent
f4cbbd7b79
commit
05cec013fe
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,7 +4,6 @@ coverage
|
|||||||
test/bench/node_modules
|
test/bench/node_modules
|
||||||
test/fixtures/output*
|
test/fixtures/output*
|
||||||
test/leak/libvips.supp
|
test/leak/libvips.supp
|
||||||
bin
|
|
||||||
lib
|
lib
|
||||||
include
|
include
|
||||||
packaging/libvips*
|
packaging/libvips*
|
||||||
|
22
binding.gyp
22
binding.gyp
@ -10,11 +10,11 @@
|
|||||||
}, {
|
}, {
|
||||||
'pkg_config_path': ''
|
'pkg_config_path': ''
|
||||||
}]
|
}]
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['OS != "win"', {
|
['OS != "win"', {
|
||||||
'global_vips_version': '<!(PKG_CONFIG_PATH="<(pkg_config_path)" which pkg-config >/dev/null 2>&1 && pkg-config --exists vips && pkg-config --modversion vips || true)'
|
'global_vips_version': '<!(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --modversion vips 2>/dev/null || true)'
|
||||||
}, {
|
}, {
|
||||||
'global_vips_version': ''
|
'global_vips_version': ''
|
||||||
}]
|
}]
|
||||||
@ -77,6 +77,24 @@
|
|||||||
'<(module_root_dir)/lib/libvips.so',
|
'<(module_root_dir)/lib/libvips.so',
|
||||||
'<(module_root_dir)/lib/libglib-2.0.so',
|
'<(module_root_dir)/lib/libglib-2.0.so',
|
||||||
'<(module_root_dir)/lib/libgobject-2.0.so',
|
'<(module_root_dir)/lib/libgobject-2.0.so',
|
||||||
|
# Dependencies of dependencies, included for openSUSE support
|
||||||
|
'<(module_root_dir)/lib/libMagickCore-6.Q16.so',
|
||||||
|
'<(module_root_dir)/lib/libMagickWand-6.Q16.so',
|
||||||
|
'<(module_root_dir)/lib/libexif.so',
|
||||||
|
'<(module_root_dir)/lib/libgio-2.0.so',
|
||||||
|
'<(module_root_dir)/lib/libgmodule-2.0.so',
|
||||||
|
'<(module_root_dir)/lib/libgsf-1.so',
|
||||||
|
'<(module_root_dir)/lib/libjpeg.so',
|
||||||
|
'<(module_root_dir)/lib/libpng.so',
|
||||||
|
'<(module_root_dir)/lib/libtiff.so',
|
||||||
|
'<(module_root_dir)/lib/libwebp.so',
|
||||||
|
'<(module_root_dir)/lib/libz.so',
|
||||||
|
'<(module_root_dir)/lib/libffi.so',
|
||||||
|
'<(module_root_dir)/lib/libgthread-2.0.so',
|
||||||
|
'<(module_root_dir)/lib/liblcms2.so',
|
||||||
|
'<(module_root_dir)/lib/libpng16.so',
|
||||||
|
'<(module_root_dir)/lib/libxml2.so',
|
||||||
|
# Ensure runtime linking is relative to sharp.node
|
||||||
'-Wl,-rpath=\'$${ORIGIN}/../../lib\''
|
'-Wl,-rpath=\'$${ORIGIN}/../../lib\''
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
|
@ -56,14 +56,14 @@ module.exports.download_vips = function() {
|
|||||||
if (!isFile(vipsHeaderPath)) {
|
if (!isFile(vipsHeaderPath)) {
|
||||||
// 32-bit
|
// 32-bit
|
||||||
if (process.arch === 'ia32') {
|
if (process.arch === 'ia32') {
|
||||||
error('32-bit systems require manual installation - see http://sharp.dimens.io/en/stable/install/');
|
error('32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||||
}
|
}
|
||||||
// Ensure libc >= 2.15
|
// Ensure libc >= 2.15
|
||||||
var lddVersion = process.env.LDD_VERSION;
|
var lddVersion = process.env.LDD_VERSION;
|
||||||
if (lddVersion) {
|
if (lddVersion) {
|
||||||
var libcVersion = lddVersion ? lddVersion.split(/\n/)[0].split(' ').slice(-1)[0].trim() : '';
|
var libcVersion = lddVersion ? lddVersion.split(/\n/)[0].split(' ').slice(-1)[0].trim() : '';
|
||||||
if (libcVersion && semver.lt(libcVersion + '.0', '2.15.0')) {
|
if (libcVersion && semver.lt(libcVersion + '.0', '2.15.0')) {
|
||||||
error('Unsupported version of libc:\n' + lddVersion + '\nPlease see http://sharp.dimens.io/en/stable/install/');
|
error('libc version ' + libcVersion + ' requires manual installation - please see http://sharp.dimens.io/en/stable/install/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Platform-specific .tar.gz
|
// Platform-specific .tar.gz
|
||||||
|
@ -21,11 +21,12 @@
|
|||||||
],
|
],
|
||||||
"description": "High performance Node.js module to resize JPEG, PNG, WebP and TIFF images using the libvips library",
|
"description": "High performance Node.js module to resize JPEG, PNG, WebP and TIFF images using the libvips library",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf test/fixtures/output.*",
|
"clean": "rm -rf build/ include/ lib/ coverage/ test/fixtures/output.*",
|
||||||
"test": "VIPS_WARNING=0 node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- --slow=5000 --timeout=20000 ./test/unit/*.js",
|
"test": "VIPS_WARNING=0 node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- --slow=5000 --timeout=20000 ./test/unit/*.js",
|
||||||
"test-clean": "npm run clean && npm install && npm test",
|
"test-win": "node ./node_modules/mocha/bin/mocha --slow=5000 --timeout=30000 ./test/unit/*.js",
|
||||||
"test-leak": "./test/leak/leak.sh",
|
"test-leak": "./test/leak/leak.sh",
|
||||||
"test-win": "node ./node_modules/mocha/bin/mocha --slow=5000 --timeout=30000 ./test/unit/*.js"
|
"test-packaging": "./packaging/test.sh",
|
||||||
|
"test-clean": "rm -rf coverage/ test/fixtures/output.* && npm install && npm test"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
58
packaging/test.sh
Executable file
58
packaging/test.sh
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Verify docker is available
|
||||||
|
if ! type docker >/dev/null; then
|
||||||
|
echo "Please install docker"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
test="npm run clean && NODE_ENV=development npm install --unsafe-perm && npm test && npm run clean"
|
||||||
|
|
||||||
|
# Debian 7
|
||||||
|
echo -n "Testing wheezy... "
|
||||||
|
if docker run -i -t --rm -v $PWD:/v nodesource/wheezy:0.12 sh -c "cd /v && ./packaging/test/debian.sh && ./preinstall.sh && $test" >/dev/null;
|
||||||
|
then echo "OK"
|
||||||
|
else echo "fail"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Debian 8
|
||||||
|
# Ubuntu 12.04, 14.04
|
||||||
|
for dist in jessie precise trusty; do
|
||||||
|
echo -n "Testing $dist... "
|
||||||
|
if docker run -i -t --rm -v $PWD:/v nodesource/$dist:0.12 sh -c "cd /v && ./packaging/test/debian.sh && $test" >/dev/null;
|
||||||
|
then echo "OK"
|
||||||
|
else echo "fail"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Centos 6
|
||||||
|
echo -n "Testing centos6... "
|
||||||
|
if docker run -i -t --rm -v $PWD:/v nodesource/centos6:0.12 sh -c "cd /v && source ./packaging/test/centos6.sh && ./preinstall.sh && $test" >/dev/null;
|
||||||
|
then echo "OK"
|
||||||
|
else echo "fail"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Centos 7
|
||||||
|
# Fedora 20, 21
|
||||||
|
|
||||||
|
for dist in centos7 fedora20 fedora21; do
|
||||||
|
echo -n "Testing $dist... "
|
||||||
|
if docker run -i -t --rm -v $PWD:/v nodesource/$dist:0.12 sh -c "cd /v && $test" >/dev/null;
|
||||||
|
then echo "OK"
|
||||||
|
else echo "fail"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# openSUSE 13.2
|
||||||
|
echo -n "Testing opensuse... "
|
||||||
|
docker run -i -t --rm -v $PWD:/v opensuse:13.2 sh -c "cd /v && ./packaging/test/opensuse.sh && $test" >/dev/null;
|
||||||
|
then echo "OK"
|
||||||
|
else echo "fail"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Archlinux 2015.06.01
|
||||||
|
echo -n "Testing archlinux... "
|
||||||
|
docker run -i -t --rm -v $PWD:/v base/archlinux:2015.06.01 sh -c "cd /v && ./packaging/test/archlinux.sh && $test" >/dev/null;
|
||||||
|
then echo "OK"
|
||||||
|
else echo "fail"
|
||||||
|
fi
|
5
packaging/test/archlinux.sh
Executable file
5
packaging/test/archlinux.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install Node.js on Archlinux
|
||||||
|
pacman -Sy --noconfirm gcc make python2 nodejs npm
|
||||||
|
ln -s /usr/bin/python2 /usr/bin/python
|
8
packaging/test/centos6.sh
Executable file
8
packaging/test/centos6.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install C++11 compatible version of g++ on Centos 6
|
||||||
|
curl -o /etc/yum.repos.d/devtools-1.1.repo http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
|
||||||
|
yum install -y devtoolset-1.1
|
||||||
|
export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc
|
||||||
|
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
|
||||||
|
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++
|
5
packaging/test/debian.sh
Executable file
5
packaging/test/debian.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install pkg-config on Debian/Ubuntu
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y pkg-config
|
7
packaging/test/opensuse.sh
Executable file
7
packaging/test/opensuse.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install Node.js on openSUSE 13.2
|
||||||
|
zypper addrepo http://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_13.2/devel:languages:nodejs.repo
|
||||||
|
zypper --gpg-auto-import-keys refresh
|
||||||
|
zypper --non-interactive install gcc-c++ make nodejs-devel
|
||||||
|
npm install -g npm
|
@ -33,7 +33,7 @@ install_libvips_from_source() {
|
|||||||
rm -rf vips-$vips_version_latest_major_minor.$vips_version_latest_patch
|
rm -rf vips-$vips_version_latest_major_minor.$vips_version_latest_patch
|
||||||
rm vips-$vips_version_latest_major_minor.$vips_version_latest_patch.tar.gz
|
rm vips-$vips_version_latest_major_minor.$vips_version_latest_patch.tar.gz
|
||||||
ldconfig
|
ldconfig
|
||||||
echo "Installed libvips $vips_version_latest_major_minor.$vips_version_latest_patch"
|
echo "Installed libvips $(PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig pkg-config --modversion vips)"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_libopenslide_from_source() {
|
install_libopenslide_from_source() {
|
||||||
@ -249,14 +249,14 @@ elif [ -f /etc/redhat-release ]; then
|
|||||||
# RHEL/CentOS 7
|
# RHEL/CentOS 7
|
||||||
echo "Installing libvips dependencies via yum"
|
echo "Installing libvips dependencies via yum"
|
||||||
yum groupinstall -y "Development Tools"
|
yum groupinstall -y "Development Tools"
|
||||||
yum install -y gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel libgsf-devel lcms2-devel ImageMagick-devel gobject-introspection-devel libwebp-devel curl
|
yum install -y tar curl gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel libgsf-devel lcms2-devel ImageMagick-devel gobject-introspection-devel libwebp-devel
|
||||||
install_libvips_from_source "--prefix=/usr"
|
install_libvips_from_source "--prefix=/usr"
|
||||||
;;
|
;;
|
||||||
"Red Hat Enterprise Linux release 6."*|"CentOS release 6."*|"Scientific Linux release 6."*)
|
"Red Hat Enterprise Linux release 6."*|"CentOS release 6."*|"Scientific Linux release 6."*)
|
||||||
# RHEL/CentOS 6
|
# RHEL/CentOS 6
|
||||||
echo "Installing libvips dependencies via yum"
|
echo "Installing libvips dependencies via yum"
|
||||||
yum groupinstall -y "Development Tools"
|
yum groupinstall -y "Development Tools"
|
||||||
yum install -y gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel libgsf-devel lcms-devel ImageMagick-devel curl
|
yum install -y tar curl gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel libgsf-devel lcms-devel ImageMagick-devel
|
||||||
yum install -y http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
|
yum install -y http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
|
||||||
yum install -y --enablerepo=nux-dextop gobject-introspection-devel
|
yum install -y --enablerepo=nux-dextop gobject-introspection-devel
|
||||||
yum install -y http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
|
yum install -y http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
// Verify platform and compiler compatibility
|
// Verify platform and compiler compatibility
|
||||||
|
|
||||||
#if (VIPS_MAJOR_VERSION < 7 || (VIPS_MAJOR_VERSION == 7 && VIPS_MINOR_VERSION < 40))
|
#if (VIPS_MAJOR_VERSION < 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 1 && VIPS_PATCH_VERSION < 1))
|
||||||
#error libvips version 7.40.0+ required - see http://sharp.dimens.io/page/install
|
#error libvips version 8.1.1+ required - see http://sharp.dimens.io/page/install
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user