Skip to content

Commit f6421a2

Browse files
committed
revert back to 3.1.0 tag
1 parent 14b99c6 commit f6421a2

File tree

9 files changed

+267
-285
lines changed

9 files changed

+267
-285
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,3 @@ typings/
7171
.aws-sam
7272
samconfig.toml
7373
packaged-template.yaml
74-
75-
tmp

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ AWS Lambda Layer providing [sharp](https://github.com/lovell/sharp) with HEIC (a
55

66
## Prerequisites
77

8-
* Docker
9-
* [SAM v1.33.0 or higher](https://github.com/awsdocs/aws-sam-developer-guide/blob/master/doc_source/serverless-sam-cli-install.md)
10-
* Node v18 (for v4.x)
8+
* Docker
9+
* [SAM v1.33.0 or higher](https://github.com/awsdocs/aws-sam-developer-guide/blob/master/doc_source/serverless-sam-cli-install.md)
10+
* Node v16 (for v3.x)
1111

1212
## Usage
1313

1414
Due to potential license concerns for the HEVC patent group, this repo can't be provided in the most convenient way which would be a shared lambda layer or an Application in the AWS Serverless Repo.
1515

1616
But you can compile and deploy this lambda layer yourself at your own risk and use it wihin your own accounts. All you need is an S3 bucket to deploy the compiled code to (replace `your-s3-bucket` in the code snippet below). Please see the note below regarding the build process.
1717

18-
It is recommended to automate this process using AWS CodeBuild. A buildspec file is provided in the repo. In that case you'll have to set the `SAM_BUCKET` environment variable in CodeBuild. For other environment variables see the table below. The base image that should be used is `aws/codebuild/amazonlinux2-x86_64-standard:5.0`.
18+
It is recommended to automate this process using AWS CodeBuild. A buildspec file is provided in the repo. In that case you'll have to set the `SAM_BUCKET` environment variable in CodeBuild. For other environment variables see the table below. The base image that should be used is `aws/codebuild/amazonlinux2-x86_64-standard:4.0`.
1919

2020
A sample CloudFormation template is provided to setup the CodeBuild project, [sample-buildproject.yaml](sample-buildproject.yaml).
2121

@@ -67,21 +67,19 @@ This lambda layer contains the node module [sharp](https://github.com/lovell/sha
6767

6868
### Dependencies
6969
The following table lists the release version of this repo together with the version of each dependency. Patch versions are related to the build process or documentation and have the same dependencies as the minor version.
70-
| release | sharp | libvips | libheif | libwebp | libde265 | nodejs |
71-
|---------|--------|---------|---------|---------|-----------|--------|
72-
| 1.1.0 | 0.27.0 | 8.10.5 | 1.10.0 | 1.1.0 | 1.0.8 | 12 |
73-
| 1.2.0 | 0.28.2 | 8.10.6 | 1.12.0 | 1.2.0 | 1.0.8 | 12 |
74-
| 2.0.0 | 0.29.1 | 8.11.3 | 1.12.0 | 1.2.1 | 1.0.8 | 14 |
75-
| 3.0.0 | 0.30.7 | 8.12.2 | 1.12.0 | 1.2.4 | 1.0.8 | 16 |
76-
| 3.1.0 | 0.30.7 | 8.12.2 | 1.12.0 | 1.2.4 | 1.0.8 | 16 |
77-
| 4.0.0 | 0.30.7 | 8.12.2 | 1.12.0 | 1.2.4 | 1.0.8 | 18 |
78-
<!-- | 4.0.0 | 0.32.6 | 8.14.5 | 1.17.1 | 1.3.2 | 1.0.12 | 18 | -->
70+
| release | sharp | libvips | libheif | libwebp | libde265 | nodejs |
71+
|---------|--------|---------|---------|---------|----------|--------|
72+
| 1.1.0 | 0.27.0 | 8.10.5 | 1.10.0 | 1.1.0 | 1.0.8 | 12 |
73+
| 1.2.0 | 0.28.2 | 8.10.6 | 1.12.0 | 1.2.0 | 1.0.8 | 12 |
74+
| 2.0.0 | 0.29.1 | 8.11.3 | 1.12.0 | 1.2.1 | 1.0.8 | 14 |
75+
| 3.0.0 | 0.30.7 | 8.12.2 | 1.12.0 | 1.2.4 | 1.0.8 | 16 |
76+
| 3.1.0 | 0.30.7 | 8.12.2 | 1.12.0 | 1.2.4 | 1.0.8 | 16 |
7977

8078
### CompatibleRuntimes
8179
- `nodejs12.x` (v1.x)
8280
- `nodejs14.x` (v2.x)
8381
- `nodejs16.x` (v3.x)
84-
- `nodejs18.x` (v4.x)
82+
8583

8684
## Contributions
8785
If you would like to contribute to this repository, please open an issue or submit a PR.

buildspec.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ env:
99
phases:
1010
install:
1111
runtime-versions:
12-
nodejs: 18
12+
nodejs: 16
13+
commands:
14+
- pip3 install aws-sam-cli --upgrade --user
1315
pre_build:
1416
commands:
1517
- NODE_ENV=development npm ci

layer/Makefile

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,52 @@
11
# Library Versions
2-
WEBP_VERSION=1.3.2
3-
LIBDE265_VERSION=1.0.12
4-
LIBHEIF_VERSION=1.17.1
5-
VIPS_VERSION=8.14.5
6-
SHARP_VERSION=0.32.6
2+
WEBP_VERSION=1.2.4
3+
LIBDE265_VERSION=1.0.8
4+
LIBHEIF_VERSION=1.12.0
5+
VIPS_VERSION=8.12.2
6+
SHARP_VERSION=0.30.7
77

8-
PREFIX_PATH=/usr/local
9-
LIB_PATH=$(PREFIX_PATH)/lib64
10-
LIBRARY_PATH=$(LIB_PATH)
11-
EXAMPLE_IMAGE_PATH=$(CURDIR)/example-images
8+
PREFIX_PATH=/opt
129

13-
export PKG_CONFIG_PATH=$(LIB_PATH)/pkgconfig
14-
export LD_LIBRARY_PATH=$(LIB_PATH):$$LD_LIBRARY_PATH
10+
export PKG_CONFIG_PATH=$(PREFIX_PATH)/lib/pkgconfig
1511

1612
build-SharpHEICLayer: libvips
1713
mkdir -p "$(ARTIFACTS_DIR)/nodejs"
1814
mkdir -p "$(ARTIFACTS_DIR)/lib"
1915

20-
# sharp uses several of the libs we installed or compiled. extract the full list and copy all of those into $(ARTIFACTS_DIR)/lib
21-
# extract list with ldd from sharp.node, manipulate a bit to only get the absolute paths, then copy
22-
23-
PKG_CONFIG_PATH=$(LIB_PATH)/pkgconfig LD_LIBRARY_PATH=$(LIB_PATH) npm install --prefix "$(ARTIFACTS_DIR)/nodejs/" --verbose --foreground-scripts sharp@$(SHARP_VERSION)
24-
PKG_CONFIG_PATH=$(LIB_PATH)/pkgconfig LD_LIBRARY_PATH=$(LIB_PATH) ldd $(ARTIFACTS_DIR)/nodejs/node_modules/sharp/build/Release/sharp-linux-x64.node | awk 'BEGIN{OFS=" "}{ print $$3 }' | grep '/' | xargs -I '{}' cp '{}' $(ARTIFACTS_DIR)/lib
25-
26-
# debug logs
27-
PKG_CONFIG_PATH=$(LIB_PATH)/pkgconfig LD_LIBRARY_PATH=$(LIB_PATH) ldd $(ARTIFACTS_DIR)/nodejs/node_modules/sharp/build/Release/sharp-linux-x64.node
28-
ls -la $(ARTIFACTS_DIR)/lib
16+
# sharp uses several of the libs we installed or compiled. extract the full list and copy all of those into /opt/lib
17+
# extract list with ldd from sharp.node, manipulate a bit with sed to only get the absolute paths, then copy
18+
LD_LIBRARY_PATH=$(PREFIX_PATH)/lib npm --prefix "$(ARTIFACTS_DIR)/nodejs/" install sharp@$(SHARP_VERSION)
19+
LD_LIBRARY_PATH=$(PREFIX_PATH)/lib ldd $(ARTIFACTS_DIR)/nodejs/node_modules/sharp/build/Release/sharp-linux-x64.node | sed -nE "s/^[^\/\n]*(\/[^ ]+)(.*)/\1/p" | xargs cp -t $(ARTIFACTS_DIR)/lib
2920

3021
libwebp:
3122
curl -L https://github.com/webmproject/libwebp/archive/v$(WEBP_VERSION).tar.gz | tar zx
3223
cd libwebp-$(WEBP_VERSION) && ./autogen.sh && ./configure --enable-libwebpmux --prefix=$(PREFIX_PATH) && make V=0 && make install
3324

3425
libde265:
26+
# libde265
3527
curl -L https://github.com/strukturag/libde265/releases/download/v$(LIBDE265_VERSION)/libde265-$(LIBDE265_VERSION).tar.gz | tar zx
3628
cd libde265-$(LIBDE265_VERSION) && ./autogen.sh && ./configure --disable-dec265 --disable-sherlock265 --prefix=$(PREFIX_PATH) && make V=0 && make install
3729

3830
libheif: libde265
3931
# libheif
4032
curl -L https://github.com/strukturag/libheif/releases/download/v$(LIBHEIF_VERSION)/libheif-$(LIBHEIF_VERSION).tar.gz | tar zx
41-
cd libheif-$(LIBHEIF_VERSION) && mkdir build && cd build && cmake -DCMAKE_INSTALL_LIBDIR=$(LIB_PATH) --preset=release .. && make && make install
33+
cd libheif-$(LIBHEIF_VERSION) && ./autogen.sh && ./configure --prefix=$(PREFIX_PATH) && make V=0 && make install
4234

43-
libvips: installLib
35+
libvips: installLib libheif libwebp
4436
# libvips
45-
curl -L https://github.com/libvips/libvips/releases/download/v$(VIPS_VERSION)/vips-$(VIPS_VERSION).tar.xz | tar xJ
46-
cd vips-$(VIPS_VERSION) && meson setup build -Dexamples=true && cd build && meson compile && meson test && meson install
47-
48-
# libheif: libde265
49-
# # libheif
50-
# curl -L https://github.com/strukturag/libheif/releases/download/v$(LIBHEIF_VERSION)/libheif-$(LIBHEIF_VERSION).tar.gz | tar zx
51-
# cd libheif-$(LIBHEIF_VERSION) && ./autogen.sh && ./configure --prefix=$(PREFIX_PATH) && make V=0 && make install
52-
# cd libheif-$(LIBHEIF_VERSION)/examples && ./heif-convert example.heic example.jpeg && cp example*.jpeg $(EXAMPLE_IMAGE_PATH) && cp example.heic $(EXAMPLE_IMAGE_PATH)
53-
54-
# libvips: installLib libheif libwebp
55-
# # libvips
56-
# curl -L https://github.com/libvips/libvips/releases/download/v$(VIPS_VERSION)/vips-$(VIPS_VERSION).tar.gz | tar zx
57-
# cd vips-$(VIPS_VERSION) && ./configure --prefix=$(PREFIX_PATH) && make V=0 && make install
58-
# cd vips-$(VIPS_VERSION)/tools && ./vips rot $(EXAMPLE_IMAGE_PATH)/example.heic $(EXAMPLE_IMAGE_PATH)/example-rot.jpeg d90
37+
curl -L https://github.com/libvips/libvips/releases/download/v$(VIPS_VERSION)/vips-$(VIPS_VERSION).tar.gz | tar zx
38+
cd vips-$(VIPS_VERSION) && ./configure --prefix=$(PREFIX_PATH) && make V=0 && make install
5939

6040
installLib:
61-
dnf groupinstall -y "Development Tools" -x system-rpm-config && \
62-
dnf install -y \
41+
yum install -y yum-plugin-ovl && \
42+
yum install -y \
6343
glib2-devel \
6444
expat-devel \
45+
libjpeg-devel \
6546
libjpeg-turbo-devel \
6647
libpng-devel \
6748
giflib-devel \
6849
libexif-devel \
6950
librsvg2-devel \
7051
libtiff-devel \
71-
lcms2-devel \
72-
gobject-introspection-devel \
73-
cmake \
74-
pkgconfig \
75-
meson \
76-
ninja-build
52+
lcms2-devel

layer/src/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "sharp-heic",
3-
"version": "4.0.0",
3+
"version": "2.0.2",
44
"description": "",
55
"main": "index.js",
66
"scripts": {},
77
"author": "Andreas Zoellner",
88
"license": "MIT",
99
"devDependencies": {},
1010
"engines": {
11-
"node": ">=18.0"
11+
"node": ">=16.0"
1212
},
1313
"dependencies": {
1414
"sharp": "^0.30.7"

0 commit comments

Comments
 (0)