diff options
Diffstat (limited to 'repo/openjpeg')
-rw-r--r-- | repo/openjpeg/b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch | 77 | ||||
-rw-r--r-- | repo/openjpeg/fix-cmakelists.patch | 11 | ||||
-rw-r--r-- | repo/openjpeg/openjpeg.xibuild | 28 |
3 files changed, 116 insertions, 0 deletions
diff --git a/repo/openjpeg/b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch b/repo/openjpeg/b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch new file mode 100644 index 0000000..169e4ad --- /dev/null +++ b/repo/openjpeg/b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch @@ -0,0 +1,77 @@ +From b4700bc09d55ac17ff6bef9b0a867f6de527be17 Mon Sep 17 00:00:00 2001 +From: Ariadne Conill <ariadne@dereferenced.org> +Date: Tue, 27 Apr 2021 09:37:40 -0600 +Subject: [PATCH] use calloc instead of malloc to allocate arrays + +--- + src/bin/jp2/opj_compress.c | 4 ++-- + src/bin/jp2/opj_decompress.c | 5 ++--- + src/bin/jp2/opj_dump.c | 6 +++--- + 3 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c +index 4cc513452..d8f894cb1 100644 +--- a/src/bin/jp2/opj_compress.c ++++ b/src/bin/jp2/opj_compress.c +@@ -1910,9 +1910,9 @@ int main(int argc, char **argv) + num_images = get_num_images(img_fol.imgdirpath); + dirptr = (dircnt_t*)malloc(sizeof(dircnt_t)); + if (dirptr) { +- dirptr->filename_buf = (char*)malloc(num_images * OPJ_PATH_LEN * sizeof( ++ dirptr->filename_buf = (char*)calloc(num_images, OPJ_PATH_LEN * sizeof( + char)); /* Stores at max 10 image file names*/ +- dirptr->filename = (char**) malloc(num_images * sizeof(char*)); ++ dirptr->filename = (char**) calloc(num_images, sizeof(char*)); + if (!dirptr->filename_buf) { + ret = 0; + goto fin; +diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c +index 487e3fa18..e54e54fce 100644 +--- a/src/bin/jp2/opj_decompress.c ++++ b/src/bin/jp2/opj_decompress.c +@@ -1357,14 +1357,13 @@ int main(int argc, char **argv) + return EXIT_FAILURE; + } + /* Stores at max 10 image file names */ +- dirptr->filename_buf = (char*)malloc(sizeof(char) * +- (size_t)num_images * OPJ_PATH_LEN); ++ dirptr->filename_buf = calloc((size_t) num_images, sizeof(char) * OPJ_PATH_LEN); + if (!dirptr->filename_buf) { + failed = 1; + goto fin; + } + +- dirptr->filename = (char**) malloc((size_t)num_images * sizeof(char*)); ++ dirptr->filename = (char**) calloc((size_t) num_images, sizeof(char*)); + + if (!dirptr->filename) { + failed = 1; +diff --git a/src/bin/jp2/opj_dump.c b/src/bin/jp2/opj_dump.c +index 754a39dd0..4e19c6177 100644 +--- a/src/bin/jp2/opj_dump.c ++++ b/src/bin/jp2/opj_dump.c +@@ -457,7 +457,7 @@ int main(int argc, char *argv[]) + opj_codestream_info_v2_t* cstr_info = NULL; + opj_codestream_index_t* cstr_index = NULL; + +- OPJ_INT32 num_images, imageno; ++ int num_images, imageno; + img_fol_t img_fol; + dircnt_t *dirptr = NULL; + +@@ -486,13 +486,13 @@ int main(int argc, char *argv[]) + if (!dirptr) { + return EXIT_FAILURE; + } +- dirptr->filename_buf = (char*)malloc((size_t)num_images * OPJ_PATH_LEN * sizeof( ++ dirptr->filename_buf = (char*) calloc((size_t) num_images, OPJ_PATH_LEN * sizeof( + char)); /* Stores at max 10 image file names*/ + if (!dirptr->filename_buf) { + free(dirptr); + return EXIT_FAILURE; + } +- dirptr->filename = (char**) malloc((size_t)num_images * sizeof(char*)); ++ dirptr->filename = (char**) calloc((size_t) num_images, sizeof(char*)); + + if (!dirptr->filename) { + goto fails; diff --git a/repo/openjpeg/fix-cmakelists.patch b/repo/openjpeg/fix-cmakelists.patch new file mode 100644 index 0000000..ee5fb01 --- /dev/null +++ b/repo/openjpeg/fix-cmakelists.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -148,7 +148,7 @@ + # We could install *.cmake files in share/ however those files contains + # hardcoded path to libraries on a multi-arch system (fedora/debian) those + # path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu) +- set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}") ++ set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/cmake/${OPENJPEG_INSTALL_SUBDIR}") + endif() + + if (APPLE) diff --git a/repo/openjpeg/openjpeg.xibuild b/repo/openjpeg/openjpeg.xibuild new file mode 100644 index 0000000..9a20ff7 --- /dev/null +++ b/repo/openjpeg/openjpeg.xibuild @@ -0,0 +1,28 @@ +#!/bin/sh + +NAME="openjpeg" +DESC="Open-source implementation of JPEG2000 image codec" + +MAKEDEPS="cmake " +DEPS="musl " + +PKG_VER=2.4.0 +SOURCE="https://github.com/uclouvain/openjpeg/archive/v$PKG_VER/openjpeg-v$PKG_VER.tar.gz" +ADDITIONAL="b4700bc09d55ac17ff6bef9b0a867f6de527be17.patch fix-cmakelists.patch " + +prepare () { + apply_patches +} + +build () { + cmake -B build \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=/usr/lib \ + -DBUILD_SHARED_LIBS=True \ + -DBUILD_STATIC_LIBS=OFF + cmake --build build +} + +package () { + DESTDIR="$PKG_DEST" cmake --install build +} |