diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2017-01-17 13:29:17 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-01-17 13:29:17 +0200 |
commit | b80b36c2d7adc0f1ac0f3e2c8dbf566b83b12724 (patch) | |
tree | d649126153df68d2927caf7fc124fcdbafb2a858 | |
parent | 2085bd30fa96455d7a18d0d76e7541742d2ba6d9 (diff) |
openjpeg: Build shared and static library
-rw-r--r-- | recipes/openjpeg.recipe | 17 | ||||
-rw-r--r-- | recipes/openjpeg/0001-Build-shared-and-static-library.patch | 35 |
2 files changed, 52 insertions, 0 deletions
diff --git a/recipes/openjpeg.recipe b/recipes/openjpeg.recipe index cfce9a8f..1f4da7dd 100644 --- a/recipes/openjpeg.recipe +++ b/recipes/openjpeg.recipe @@ -1,3 +1,7 @@ +import shutil + +from cerbero.tools.libtool import LibtoolLibrary + class Recipe(recipe.Recipe): version = '2.1.0' name = 'openjpeg' @@ -6,9 +10,22 @@ class Recipe(recipe.Recipe): btype = BuildType.CMAKE url = 'http://downloads.sourceforge.net/project/openjpeg.mirror/2.1.0/openjpeg-2.1.0.tar.gz' configure_options = ' -DBUILD_CODEC:bool=off -DBUILD_PKGCONFIG_FILES:bool=on ' + patches = ['openjpeg/0001-Build-shared-and-static-library.patch'] files_libs = ['libopenjp2'] files_devel = ['include/openjpeg-2.1/openjpeg.h', 'include/openjpeg-2.1/opj_stdint.h', 'include/openjpeg-2.1/opj_config.h', 'lib/pkgconfig/libopenjp2.pc'] + + def install(self): + super(recipe.Recipe, self).install() + shutil.move( + os.path.join(self.config.prefix, 'lib', 'libopenjp2_static.a'), + os.path.join(self.config.prefix, 'lib', 'libopenjp2.a')) + + def post_install(self): + deps = ['m'] + libtool_la = LibtoolLibrary('openjp2', 2, 1, None, self.config.libdir, + self.config.target_platform, deps) + libtool_la.save() diff --git a/recipes/openjpeg/0001-Build-shared-and-static-library.patch b/recipes/openjpeg/0001-Build-shared-and-static-library.patch new file mode 100644 index 00000000..fa3dccd6 --- /dev/null +++ b/recipes/openjpeg/0001-Build-shared-and-static-library.patch @@ -0,0 +1,35 @@ +From 61c9f553d816c4a512494dac02f48c00d4bb1261 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com> +Date: Tue, 17 Jan 2017 13:25:53 +0200 +Subject: [PATCH] Build shared and static library + +--- + src/lib/openjp2/CMakeLists.txt | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt +index fcf60ec..bf82a6f 100644 +--- a/src/lib/openjp2/CMakeLists.txt ++++ b/src/lib/openjp2/CMakeLists.txt +@@ -54,9 +54,17 @@ if(UNIX) + target_link_libraries(${OPENJPEG_LIBRARY_NAME} m) + endif() + set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES}) ++set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES COMPILE_DEFINITIONS OPJ_EXPORTS) ++ ++add_library(${OPENJPEG_LIBRARY_NAME}_static STATIC ${OPENJPEG_SRCS}) ++if(UNIX) ++ target_link_libraries(${OPENJPEG_LIBRARY_NAME}_static m) ++endif() ++set_target_properties(${OPENJPEG_LIBRARY_NAME}_static PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES}) ++set_target_properties(${OPENJPEG_LIBRARY_NAME}_static PROPERTIES COMPILE_DEFINITIONS OPJ_STATIC) + + # Install library +-install(TARGETS ${OPENJPEG_LIBRARY_NAME} ++install(TARGETS ${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_LIBRARY_NAME}_static + EXPORT OpenJPEGTargets + RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications + LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries +-- +2.11.0 + |