Skip to content

Commit cfa5896

Browse files
authored
Fixes Analyse-coverage on Linux with ppa:strukturag/libheif (#104)
* added `heif_init` call Signed-off-by: Alexander Piskun <[email protected]> * fixed: Building from source with `ppa:strukturag/libheif` repo Signed-off-by: Alexander Piskun <[email protected]> --------- Signed-off-by: Alexander Piskun <[email protected]>
1 parent e999ffe commit cfa5896

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

.github/workflows/analysis-coverage.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
- name: Prepare system
4747
run: |
4848
sudo apt -y purge libheif1
49-
sudo apt -y install libaom-dev libx265-dev libde265-dev nasm
5049
sudo add-apt-repository ppa:strukturag/libheif
5150
sudo apt update
5251
sudo apt -y install libheif-dev
@@ -90,7 +89,6 @@ jobs:
9089
- name: Prepare system
9190
run: |
9291
sudo apt -y purge libheif1
93-
sudo apt -y install libaom-dev libx265-dev libde265-dev nasm
9492
sudo add-apt-repository ppa:strukturag/libheif
9593
sudo apt update
9694
sudo apt -y install libheif-dev

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This release is fully compatible with `0.10.x+` versions.
1414

1515
## Fixed
1616

17+
- Building from source when using `apt-repository ppa:strukturag/libheif`
1718
- (Heif) `encode` function with `stride` argument correctly saves image.
1819
- (Heif) HeifFile class created with `from_bytes` function with `stride` argument respect `stride` value during save.
1920
- (Heif) HeifFile class created with `from_bytes` function with `stride` argument can correctly translate to numpy array.

libheif/macos/libheif.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Libheif < Formula
99
# Set current revision from what it was taken plus 10
1010
revision 10
1111

12+
depends_on "cmake" => :build
1213
depends_on "pkg-config" => :build
1314
depends_on "aom"
1415
depends_on "jpeg-turbo"
@@ -18,8 +19,16 @@ class Libheif < Formula
1819
depends_on "x265"
1920

2021
def install
21-
system "./configure", *std_configure_args, "--disable-silent-rules"
22-
system "make", "install"
22+
args = %W[
23+
-DWITH_RAV1E=OFF
24+
-DWITH_DAV1D=OFF
25+
-DWITH_SvtEnc=OFF
26+
-DENABLE_PLUGIN_LOADING=OFF
27+
-DCMAKE_INSTALL_RPATH=#{rpath}
28+
]
29+
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
30+
system "cmake", "--build", "build"
31+
system "cmake", "--install", "build"
2332
pkgshare.install "examples/example.heic"
2433
pkgshare.install "examples/example.avif"
2534
end

pi-heif/libheif/macos/libheif.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ class Libheif < Formula
99
# Set current revision from what it was taken plus 10
1010
revision 10
1111

12+
depends_on "cmake" => :build
1213
depends_on "pkg-config" => :build
1314
depends_on "libde265"
1415

1516
def install
16-
system "./configure", *std_configure_args, "--disable-silent-rules"
17-
system "make", "install"
17+
args = %W[
18+
-DWITH_RAV1E=OFF
19+
-DWITH_DAV1D=OFF
20+
-DWITH_SvtEnc=OFF
21+
-DWITH_AOM=OFF
22+
-DWITH_X265=OFF
23+
-DENABLE_PLUGIN_LOADING=OFF
24+
-DCMAKE_INSTALL_RPATH=#{rpath}
25+
]
26+
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
27+
system "cmake", "--build", "build"
28+
system "cmake", "--install", "build"
1829
end
1930
end

pillow_heif/_pillow_heif.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,10 @@ static int setup_module(PyObject* m) {
11691169
if (PyType_Ready(&CtxImage_Type) < 0)
11701170
return -1;
11711171

1172+
#if LIBHEIF_HAVE_VERSION(1,14,0)
1173+
heif_init(NULL);
1174+
#endif
1175+
11721176
const struct heif_encoder_descriptor* encoder_descriptor;
11731177
const char* x265_version = "";
11741178
if (heif_context_get_encoder_descriptors(NULL, heif_compression_HEVC, NULL, &encoder_descriptor, 1))

0 commit comments

Comments
 (0)