Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gdk-pixbuf 2.42.0 #3623

Merged
merged 8 commits into from
Nov 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/gdk-pixbuf/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"2.42.0":
url: "http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.42/gdk-pixbuf-2.42.0.tar.xz"
sha256: "73441338d1a901dc7a3940113cb0aac22776b2832f7eab8f8ec7ec5755adaec7"
123 changes: 123 additions & 0 deletions recipes/gdk-pixbuf/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
from conans import ConanFile, Meson, tools
from conans.errors import ConanInvalidConfiguration
import os
import shutil

ericLemanissier marked this conversation as resolved.
Show resolved Hide resolved

required_conan_version = ">=1.29.1"



class LibnameConan(ConanFile):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class LibnameConan(ConanFile):
class GdkPixbufConan(ConanFile):

name = "gdk-pixbuf"
description = "toolkit for image loading and pixel buffer manipulation"
topics = ("conan", "gdk-pixbuf", "image")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://developer.gnome.org/gdk-pixbuf/"
license = "LGPL-2.1-or-later"
generators = "pkg_config"

settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_libpng": [True, False],
"with_libtiff": [True, False],
"with_libjpeg": ["libjpeg", "libjpeg-turbo", False],
"with_jasper": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_libpng": True,
"with_libtiff": True,
"with_libjpeg": "libjpeg",
"with_jasper": False,
}

_source_subfolder = "source_subfolder"
_build_subfolder = "build_subfolder"

def config_options(self):
if self.settings.os == 'Windows':
del self.options.fPIC

def configure(self):
if self.options.shared:
del self.options.fPIC
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
if self.settings.os == "Macos":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.settings.os == "Macos":
if tools.is_apple_os(self.settings.os):

# when running gdk-pixbuf-query-loaders
# dyld: malformed mach-o: load commands size (97560) > 32768
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I remember this error, it happened for me during GCC build. I'll try to find out what was the compiler flag to fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if dyld is not trying to load a static library

raise ConanInvalidConfiguration('This package does not support Macos currently')

def build_requirements(self):
self.build_requires('meson/0.54.2')
self.build_requires('pkgconf/1.7.3')

def requirements(self):
self.requires('glib/2.67.0')
if self.options.with_libpng:
self.requires('libpng/1.6.37')
if self.options.with_libtiff:
self.requires('libtiff/4.0.9')
if self.options.with_libjpeg == "libjpeg-turbo":
self.requires("libjpeg-turbo/2.0.5")
elif self.options.with_libjpeg == "libjpeg":
self.requires("libjpeg/9d")
if self.options.with_jasper:
self.requires('jasper/2.0.19')

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), "subdir('tests')", "#subdir('tests')")
tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), "subdir('thumbnailer')", "#subdir('thumbnailer')")
tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"), "gmodule_dep.get_pkgconfig_variable('gmodule_supported')", "'true'")

def _configure_meson(self):
meson = Meson(self)
defs = {}
defs['gir'] = 'false'
defs['docs'] = 'false'
defs['man'] = 'false'
defs['installed_tests'] = 'false'
defs['png'] = 'true' if self.options.with_libpng else 'false'
defs['tiff'] = 'true' if self.options.with_libtiff else 'false'
defs['jpeg'] = 'true' if self.options.with_libjpeg else 'false'
defs['jasper'] = 'true' if self.options.with_jasper else 'false'
defs['x11'] = 'false'
defs['builtin_loaders'] = 'all'
defs['gio_sniffing'] = 'false'
args=[]
args.append('--wrap-mode=nofallback')
meson.configure(defs=defs, build_folder=self._build_subfolder, source_folder=self._source_subfolder, pkg_config_paths='.', args=args)
return meson

def build(self):
shutil.move('libpng.pc', 'libpng16.pc')
meson = self._configure_meson()
meson.build()

def package(self):
self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder)
with tools.environment_append({'LD_LIBRARY_PATH': os.path.join(self.package_folder, 'lib')}):
meson = self._configure_meson()
meson.install()
if self.settings.compiler == "Visual Studio" and not self.options.shared:
os.rename(os.path.join(self.package_folder, 'lib', 'libgdk_pixbuf-2.0.a'), os.path.join(self.package_folder, 'lib', 'gdk_pixbuf-2.0.lib'))
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
tools.rmdir(os.path.join(self.package_folder, "share"))
tools.remove_files_by_mask(self.package_folder, "*.pdb")

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.includedirs = ['include/gdk-pixbuf-2.0']
self.cpp_info.names['pkg_config'] = 'gdk-pixbuf-2.0'
if not self.options.shared:
self.cpp_info.defines.append('GDK_PIXBUF_STATIC_COMPILATION')
if self.settings.os == 'Linux':
self.cpp_info.system_libs = ['m']
self.env_info.GDK_PIXBUF_PIXDATA = os.path.join(self.package_folder, 'bin', 'gdk-pixbuf-pixdata')
9 changes: 9 additions & 0 deletions recipes/gdk-pixbuf/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)


include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
18 changes: 18 additions & 0 deletions recipes/gdk-pixbuf/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run("gdk-pixbuf-pixdata -v", run_environment=True)
self.run(bin_path, run_environment=True)
20 changes: 20 additions & 0 deletions recipes/gdk-pixbuf/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>
#include "gdk-pixbuf/gdk-pixbuf.h"

int main()
{
GdkPixbuf *pixbuf;
printf("gdk-pixbuf version %s %d.%d.%d\n", gdk_pixbuf_version, gdk_pixbuf_major_version, gdk_pixbuf_minor_version, gdk_pixbuf_micro_version);
uilianries marked this conversation as resolved.
Show resolved Hide resolved
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 100, 100);

g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
g_assert (gdk_pixbuf_get_n_channels (pixbuf) == 4);

g_assert (gdk_pixbuf_get_width (pixbuf) == 100);
g_assert (gdk_pixbuf_get_height (pixbuf) == 100);

g_object_unref(pixbuf);
return 0;
}
3 changes: 3 additions & 0 deletions recipes/gdk-pixbuf/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"2.42.0":
folder: all