Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
conan dependencies
Browse files Browse the repository at this point in the history
all the dependencies of Qt which have a conan recipe are now handled as requirements, based on an option:
openssl, pcre2, doubleconversion, freetype, harfbuzz, libjpeg, libpng, sqlite3, pq, odbc
  • Loading branch information
ericLemanissier committed Jan 30, 2019
1 parent 41a38ac commit 6a2891a
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 225 deletions.
4 changes: 2 additions & 2 deletions .ci/install.sh
Expand Up @@ -13,8 +13,8 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
eval "$(pyenv init -)"
fi

pyenv install 2.7.10
pyenv virtualenv 2.7.10 conan
pyenv install 3.7.1
pyenv virtualenv 3.7.1 conan
pyenv rehash
pyenv activate conan
fi
Expand Down
391 changes: 196 additions & 195 deletions .travis.yml

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions README.md
@@ -1,5 +1,5 @@
[![Download](https://api.bintray.com/packages/bincrafters/public-conan/qt%3Abincrafters/images/download.svg) ](https://bintray.com/bincrafters/public-conan/qt%3Abincrafters/_latestVersion)
[![Build Status Travis](https://travis-ci.org/bincrafters/conan-qt.svg?branch=stable%2F5.12.0)](https://travis-ci.org/bincrafters/conan-qt)
[![Build Status Travis](https://travis-ci.com/bincrafters/conan-qt.svg?branch=stable%2F5.12.0)](https://travis-ci.com/bincrafters/conan-qt)
[![Build Status AppVeyor](https://ci.appveyor.com/api/projects/status/github/bincrafters/conan-qt?branch=stable%2F5.12.0&svg=true)](https://ci.appveyor.com/project/bincrafters/conan-qt)

## Conan package recipe for [*qt*](https://www.qt.io)
Expand All @@ -11,9 +11,9 @@ The packages generated with this **conanfile** can be found on [Bintray](https:/

## Issues

If you wish to report an issue or make a request for a Bincrafters package, please do so here:
If you wish to report an issue or make a request for a package, please do so here:

[Bincrafters Community Issues](https://github.com/bincrafters/community/issues)
[Issues Tracker](https://github.com/bincrafters/community/issues)


## For Users
Expand Down Expand Up @@ -52,7 +52,16 @@ The following command both runs all the steps of the conan file, and publishes t
| shared | True | [True, False] |
| commercial | False | [True, False] |
| opengl | desktop | ['no', 'es2', 'desktop', 'dynamic'] |
| openssl | False | [True, False] |
| openssl | True | [True, False] |
| with_pcre2 | True | [True, False] |
| with_doubleconversion | True | [True, False] |
| with_freetype | True | [True, False] |
| with_harfbuzz | True | [True, False] |
| with_libjpeg | True | [True, False] |
| with_libpng | True | [True, False] |
| with_sqlite3 | True | [True, False] |
| with_pq | True | [True, False] |
| with_odbc | True | [True, False] |
| GUI | True | [True, False] |
| widgets | True | [True, False] |
| device | | ANY |
Expand Down
3 changes: 1 addition & 2 deletions appveyor.yml
Expand Up @@ -8,7 +8,6 @@ environment:
matrix:
- MINGW_CONFIGURATIONS: '4.9@x86@dwarf2@posix'
- MINGW_CONFIGURATIONS: '4.9@x86_64@seh@posix'
- MINGW_CONFIGURATIONS: '4.9@x86_64@sjlj@posix'
- MINGW_CONFIGURATIONS: '6@x86@dwarf2@posix'
- MINGW_CONFIGURATIONS: '6@x86_64@seh@posix'
- MINGW_CONFIGURATIONS: '7@x86@dwarf2@posix'
Expand Down Expand Up @@ -113,7 +112,7 @@ environment:
CONAN_CURRENT_PAGE: 6

install:
- set PATH=%PATH%;%PYTHON%/Scripts/
- set PATH=%PYTHON%;%PYTHON%/Scripts/;%PATH%
- pip.exe install conan --upgrade
- pip.exe install conan_package_tools bincrafters_package_tools
- conan user # It creates the conan data directory
Expand Down
2 changes: 1 addition & 1 deletion build.py
Expand Up @@ -5,5 +5,5 @@

if __name__ == "__main__":

builder = build_template_default.get_builder()
builder = build_template_default.get_builder(build_policy="missing")
builder.run()
157 changes: 141 additions & 16 deletions conanfile.py
Expand Up @@ -49,18 +49,33 @@ def _getsubmodules():
topics = ("conan", "qt", "ui")
url = "https://github.com/bincrafters/conan-qt"
homepage = "https://www.qt.io"
license = "LGPL-3.0-only"
license = "LGPL-3.0"
author = "Bincrafters <bincrafters@gmail.com>"
exports = ["LICENSE.md", "qtmodules.conf", "*.diff"]
settings = "os", "arch", "compiler", "build_type"

options = dict({
"shared": [True, False],
"commercial": [True, False],

"opengl": ["no", "es2", "desktop", "dynamic"],
"openssl": [True, False],
"with_pcre2": [True, False],
# "with_glib": [True, False], # Qt relies on pkg-config for consuming glib
# "with_libiconv": [True, False], # Qt tests failure "invalid conversion from const char** to char**"
"with_doubleconversion": [True, False],
"with_freetype": [True, False],
# "with_icu": [True, False], # waiting for 64.1 or 63.2
"with_harfbuzz": [True, False],
"with_libjpeg": [True, False],
"with_libpng": [True, False],
"with_sqlite3": [True, False],
"with_pq": [True, False],
"with_odbc": [True, False],

"GUI": [True, False],
"widgets": [True, False],

"device": "ANY",
"cross_compile": "ANY",
"config": "ANY",
Expand All @@ -71,14 +86,29 @@ def _getsubmodules():
"shared": True,
"commercial": False,
"opengl": "desktop",
"openssl": False,
"openssl": True,
"with_pcre2": True,
# "with_glib": True,
# "with_libiconv": True,
"with_doubleconversion": True,
"with_freetype": True,
# "with_icu": True,
"with_harfbuzz": True,
"with_libjpeg": True,
"with_libpng": True,
"with_sqlite3": True,
"with_pq": True,
"with_odbc": True,

"GUI": True,
"widgets": True,

"device": None,
"cross_compile": None,
"config": None,
}, **{module: False for module in _submodules}
)
requires = "zlib/1.2.11@conan/stable"
short_paths = True
build_policy = "missing"

Expand Down Expand Up @@ -119,13 +149,21 @@ def build_requirements(self):
self.build_requires("jom_installer/1.1.2@bincrafters/stable")

def configure(self):
if self.options.openssl:
self.requires("OpenSSL/1.1.0g@conan/stable")
self.options["OpenSSL"].no_zlib = True
# if self.settings.os != 'Linux':
# self.options.with_glib = False
# self.options.with_libiconv = False
if self.settings.os == "Windows":
self.options.with_pq = False

if self.options.widgets:
self.options.GUI = True
if not self.options.GUI:
self.options.opengl = "no"
self.options.with_freetype = False
self.options.with_harfbuzz = False
self.options.with_libjpeg = False
self.options.with_libpng = False

if self.settings.os == "Android" and self.options.opengl == "desktop":
raise ConanInvalidConfiguration("OpenGL desktop is not supported on Android. Consider using OpenGL es2")

Expand All @@ -141,6 +179,44 @@ def _enablemodule(mod):
if getattr(self.options, module):
_enablemodule(module)

def requirements(self):
if self.options.openssl:
self.requires("OpenSSL/1.1.1a@conan/stable")
self.options["OpenSSL"].no_zlib = False
if self.options.with_pcre2:
self.requires("pcre2/10.32@bincrafters/stable")

# if self.options.with_glib:
# self.requires("glib/2.57.1@bincrafters/stable")
# if self.options.with_libiconv:
# self.requires("libiconv/1.15@bincrafters/stable")
if self.options.with_doubleconversion:
self.requires("double-conversion/3.1.1@bincrafters/stable")
if self.options.with_freetype:
self.requires("freetype/2.9.0@bincrafters/stable")
self.options["freetype"].with_png = self.options.with_libpng
self.options["freetype"].with_zlib = True
# if self.options.with_icu:
# self.requires("icu/63.1@bincrafters/stable")
# self.options["icu"].shared = self.options.shared
if self.options.with_harfbuzz:
self.requires("harfbuzz/2.3.0@bincrafters/stable")
self.options["harbuzz"].with_freetype = self.options.with_freetype
if self.options.with_libjpeg:
self.requires("libjpeg/9c@bincrafters/stable")
if self.options.with_libpng:
self.requires("libpng/1.6.34@bincrafters/stable")
if self.options.with_sqlite3:
self.requires("sqlite3/3.26.0@bincrafters/stable")
self.options["sqlite3"].enable_column_metadata = True
if self.options.with_pq:
self.requires("libpq/9.6.9@bincrafters/stable")
self.options["libpq"].with_zlib = True
self.options["libpq"].with_openssl = False
if self.options.with_odbc:
self.requires("odbc/2.3.7@bincrafters/stable")
self.options["odbc"].shared = (self.settings.os == "Windows")

def system_requirements(self):
if self.options.GUI:
pack_names = []
Expand Down Expand Up @@ -170,14 +246,14 @@ def source(self):
url = "http://download.qt.io/official_releases/qt/{0}/{1}/single/qt-everywhere-src-{1}" \
.format(self.version[:self.version.rfind('.')], self.version)
if tools.os_info.is_windows:
tools.get("%s.zip" % url, md5='66eaa8f2ad1b8a1867458187a31d0a88')
tools.get("%s.zip" % url, sha256='a60a82069d2180a2905913b6e8a901cbcbb74e6a749d25de3a892dc97151b31d')
elif sys.version_info.major >= 3:
tools.get("%s.tar.xz" % url, md5='af569de3eb42da4457b0897e5759dc91')
tools.get("%s.tar.xz" % url, sha256='356f42d9087718f22f03d13d0c2cdfb308f91dc3cf0c6318bed33f2094cd9d6c')
else: # python 2 cannot deal with .xz archives
self.run("wget -qO- %s.tar.xz | tar -xJ " % url)
shutil.move("qt-everywhere-src-%s" % self.version, "qt5")

for patch in ["cc04651dea4c4678c626cb31b3ec8394426e2b25.diff"]:
for patch in ["cc04651dea4c4678c626cb31b3ec8394426e2b25.diff", "fffe5d622549f85968ea0be9717b90cbc020be71.diff"]:
tools.patch("qt5/qtbase", patch)

def _xplatform(self):
Expand Down Expand Up @@ -299,10 +375,58 @@ def build(self):
args += ["-openssl-linked"]
else:
args += ["-openssl"]
args += ["-I %s" % i for i in self.deps_cpp_info["OpenSSL"].include_paths]
libs = self.deps_cpp_info["OpenSSL"].libs
lib_paths = self.deps_cpp_info["OpenSSL"].lib_paths
os.environ["OPENSSL_LIBS"] = " ".join(["-L" + i for i in lib_paths] + ["-l" + i for i in libs])

# args.append("--iconv=" + ("gnu" if self.options.with_libiconv else "no"))

# args.append("--glib=" + ("yes" if self.options.with_glib else "no")
args.append("--pcre=" + ("system" if self.options.with_pcre2 else "qt"))
# args.append("--icu=" + ("yes" if self.options.with_icu else "no"))
args.append("--sql-psql=" + ("yes" if self.options.with_pq else "no"))
args.append("--sql-odbc=" + ("yes" if self.options.with_odbc else "no"))

for opt, conf_arg in [
("with_doubleconversion", "doubleconversion"),
("with_freetype", "freetype"),
("with_harfbuzz", "harfbuzz"),
("with_libjpeg", "libjpeg"),
("with_libpng", "libpng"),
("with_sqlite3", "sqlite")]:
if getattr(self.options, opt):
args += ["-system-" + conf_arg]
else:
args += ["-no-" + conf_arg]

libmap = [("zlib", "ZLIB"),
("OpenSSL", "OPENSSL"),
("pcre2", "PCRE2"),
# ("glib", "GLIB"),
# ("libiconv", "ICONV"),
("double-conversion", "DOUBLECONVERSION"),
("freetype", "FREETYPE"),
# ("icu", "ICU"),
("harfbuzz", "HARFBUZZ"),
("libjpeg", "LIBJPEG"),
("libpng", "LIBPNG"),
("sqlite3", "SQLITE"),
("libpq", "PSQL"),
("odbc", "ODBC")]
for package, var in libmap:
if package in self.deps_cpp_info.deps:
if self.deps_cpp_info[package].include_paths:
args.append("\"%s_INCDIR=%s\"" % (var, self.deps_cpp_info[package].include_paths[-1]))
for lib_path in self.deps_cpp_info[package].lib_paths:
args.append("\"%s_LIBDIR=%s\"" % (var, lib_path))
break
args += ["-D " + s for s in self.deps_cpp_info[package].defines]

def _gather_libs(p):
libs = ["-l" + i for i in self.deps_cpp_info[p].libs]
libs += self.deps_cpp_info[p].sharedlinkflags
for dep in self.deps_cpp_info[p].public_deps:
libs += ["-L" + lpath for lpath in self.deps_cpp_info[dep].lib_paths]
libs += _gather_libs(dep)
return libs
args.append("\"%s_LIBS=%s\"" % (var, " ".join(_gather_libs(package))))

if self.settings.os == "Linux":
if self.options.GUI:
Expand Down Expand Up @@ -358,12 +482,13 @@ def _getenvpath(var):
if self.options.config:
args.append(str(self.options.config))

args.append("-qt-zlib")

def _build(make):
with tools.environment_append({"MAKEFLAGS": "j%d" % tools.cpu_count()}):
self.run("%s/qt5/configure %s" % (self.source_folder, " ".join(args)))
self.run(make)
try:
self.run("%s/qt5/configure %s" % (self.source_folder, " ".join(args)))
finally:
self.output.info(open('config.log', 'r').read())
self.run(make, run_environment=True)
self.run("%s install" % make)

if tools.os_info.is_windows:
Expand Down
31 changes: 31 additions & 0 deletions fffe5d622549f85968ea0be9717b90cbc020be71.diff
@@ -0,0 +1,31 @@
From fffe5d622549f85968ea0be9717b90cbc020be71 Mon Sep 17 00:00:00 2001
From: Eric Lemanissier <eric.lemanissier@gmail.com>
Date: Mon, 21 Jan 2019 13:14:09 +0100
Subject: [PATCH] configure: handle FREETYPE_* variables

This allows the user to set the following variables:
FREETYPE_INCDIR
FREETYPE_LIBDIR
FREETYPE_LIBS

Fixes: QTBUG-72765
Change-Id: Ib70b30f355cc2185c45233e0cfe5e6e55acdf2b6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
---
src/gui/configure.json | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/gui/configure.json b/src/gui/configure.json
index 0332631ec8..82ca9603b1 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -164,6 +164,7 @@
},
"sources": [
{ "type": "pkgConfig", "args": "freetype2" },
+ { "libs": "-lfreetype" },
{ "type": "freetype", "libs": "-lfreetype", "condition": "!config.wasm" },
{ "type": "freetype", "libs": "-s USE_FREETYPE=1", "condition": "config.wasm" }
]
--
2.18.0.windows.1
10 changes: 5 additions & 5 deletions test_package/conanfile.py
Expand Up @@ -46,11 +46,11 @@ def _getenvpath(var):
self.run("qmake %s" % " ".join(args), run_environment=True)
if tools.os_info.is_windows:
if self.settings.compiler == "Visual Studio":
self.run("jom")
self.run("jom", run_environment=True)
else:
self.run("mingw32-make")
self.run("mingw32-make", run_environment=True)
else:
self.run("make")
self.run("make", run_environment=True)

if self.settings.compiler == "Visual Studio":
with tools.vcvars(self.settings):
Expand Down Expand Up @@ -82,7 +82,7 @@ def _test_with_qmake(self):
bin_path = os.path.join("test_package.app", "Contents", "MacOS")
bin_path = os.path.join("qmake_folder", bin_path)
shutil.copy("qt.conf", bin_path)
self.run(os.path.join(bin_path, "test_package"))
self.run(os.path.join(bin_path, "test_package"), run_environment=True)

def _test_with_cmake(self):
if not self.options["qt"].shared:
Expand All @@ -94,7 +94,7 @@ def _test_with_cmake(self):
bin_path = str(self.settings.build_type)
else:
bin_path = self.build_folder
self.run(os.path.join(bin_path, "test_package"))
self.run(os.path.join(bin_path, "test_package"), run_environment=True)

def test(self):
if (not tools.cross_building(self.settings)) or\
Expand Down

0 comments on commit 6a2891a

Please sign in to comment.