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

qscintilla: new recipe #25236

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
102 changes: 102 additions & 0 deletions recipes/qscintilla/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Reproduces https://github.com/brCreate/QScintilla/blob/6cdb1f9876038ad3ce5955ee473b8f8e503aa2d5/src/qscintilla.pro
cmake_minimum_required(VERSION 3.15)
project(QScintilla LANGUAGES CXX)

option(QSCINTILLA_BUILD_DESIGNER_PLUGIN "Build the QScintilla designer plugin" OFF)

if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_AUTOMOC ON)

find_package(Qt6 REQUIRED)
if(NOT Qt6_FOUND)
find_package(Qt5 REQUIRED)
endif()

set(LIB_NAME "qscintilla2_qt${QT_VERSION_MAJOR}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(APPLE)
string(APPEND LIB_NAME "_debug")
elseif(WIN32)
string(APPEND LIB_NAME "d")
endif()
endif()
if(NOT BUILD_SHARED_LIBS)
string(APPEND LIB_NAME "_static")
endif()

file(GLOB SOURCES
scintilla/src/*.cpp
scintilla/lexlib/*.cpp
scintilla/lexers/*.cpp
src/*.cpp
)
file(GLOB HEADERS
scintilla/src/*.h
scintilla/lexlib/*.h
scintilla/include/*.h
src/*.h
src/Qsci/*.h
)
if(IOS)
list(REMOVE_ITEM SOURCES src/qsciprinter.cpp)
list(REMOVE_ITEM HEADERS src/Qsci/qsciprinter.h)
endif()

add_library(QScintilla ${SOURCES} ${HEADERS})
set_target_properties(QScintilla PROPERTIES OUTPUT_NAME ${LIB_NAME})
target_include_directories(QScintilla
PUBLIC
src
PRIVATE
scintilla/include
scintilla/lexlib
scintilla/src
)
target_compile_definitions(QScintilla PRIVATE
SCINTILLA_QT
SCI_LEXER
INCLUDE_DEPRECATED_FEATURES
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(QScintilla PRIVATE QSCINTILLA_MAKE_DLL)
endif()

target_link_libraries(QScintilla PUBLIC Qt${QT_VERSION_MAJOR}::Widgets)
if(NOT IOS)
target_link_libraries(QScintilla PUBLIC Qt${QT_VERSION_MAJOR}::PrintSupport)
endif()
if(QT_VERSION_MAJOR EQUAL 5 AND APPLE)
target_link_libraries(QScintilla PUBLIC Qt5::MacExtras)
endif()

if(QSCINTILLA_BUILD_DESIGNER_PLUGIN)
# Reproduces https://github.com/brCreate/QScintilla/blob/6cdb1f9876038ad3ce5955ee473b8f8e503aa2d5/designer/designer.pro
add_library(qscintillaplugin MODULE designer/qscintillaplugin.cpp)
target_link_libraries(qscintillaplugin PRIVATE
QScintilla
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Designer
)
include(GNUInstallDirs)
install(TARGETS qscintillaplugin DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt/plugins/designer)
endif()

include(GNUInstallDirs)
install(TARGETS QScintilla
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(DIRECTORY src/Qsci DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
file(GLOB TRANSLATION_FILES src/qscintilla_*.qm)
install(FILES ${TRANSLATION_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/translations)
if(BUILD_SHARED_LIBS)
install(FILES src/features/qscintilla2.prf DESTINATION ${CMAKE_INSTALL_DATADIR}/mkspecs/features)
else()
install(FILES src/features_staticlib/qscintilla2.prf DESTINATION ${CMAKE_INSTALL_DATADIR}/mkspecs/features)
endif()
14 changes: 14 additions & 0 deletions recipes/qscintilla/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sources:
"2.14.1":
url: "https://www.riverbankcomputing.com/static/Downloads/QScintilla/2.14.1/QScintilla_src-2.14.1.tar.gz"
sha256: "dfe13c6acc9d85dfcba76ccc8061e71a223957a6c02f3c343b30a9d43a4cdd4d"
patches:
"2.14.1":
- patch_file: "patches/0004-remove-logo-privacy-issue.patch"
patch_description: "Fix logo privacy issue"
patch_type: "conan"
patch_source: "https://salsa.debian.org/python-team/packages/qscintilla2/-/blob/debian/2.14.1+dfsg-1/debian/patches/0004-remove-logo-privacy-issue.diff.patch"
- patch_file: "patches/0010-Add-import-QUrl.patch"
patch_description: "Add QUrl include"
patch_type: "bugfix"
patch_source: "https://salsa.debian.org/python-team/packages/qscintilla2/-/blob/debian/2.14.1+dfsg-1/debian/patches/0010-Add-import-QUrl.patch"
96 changes: 96 additions & 0 deletions recipes/qscintilla/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import os

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd, can_run
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get

required_conan_version = ">=2.0.5"


class QScintillaConan(ConanFile):
name = "qscintilla"
description = "QScintilla is a Qt port of the Scintilla text editing component"
license = "GPL-3.0-only"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://riverbankcomputing.com/software/qscintilla"
topics = ("qt", "scintilla", "text-editor", "widget")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

def export_sources(self):
export_conandata_patches(self)
copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src"))

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

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
self.options["qt"].widgets = True

def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("qt/[>=6.7.1 <7]", transitive_headers=True, transitive_libs=True, run=can_run(self))

def validate(self):
check_min_cppstd(self, 11)
if not self.dependencies["qt"].options.widgets:
raise ConanInvalidConfiguration("QScintilla requires -o qt/*:widgets=True")

def build_requirements(self):
if not can_run(self):
self.tool_requires("qt/<host_version>")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["QSCINTILLA_BUILD_DESIGNER_PLUGIN"] = self.dependencies["qt"].options.qttools
tc.generate()
deps = CMakeDeps(self)
deps.generate()

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

def package(self):
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()

def package_info(self):
qt_major = self.dependencies["qt"].ref.version.major
lib_name = f"qscintilla2_qt{qt_major}"
if self.settings.build_type == "Debug":
if is_apple_os(self):
lib_name += "_debug"
elif self.settings.os == "Windows":
lib_name += "d"
if not self.options.shared:
lib_name += "_static"
self.cpp_info.libs = [lib_name]

self.cpp_info.requires = ["qt::qtWidgets"]
if self.settings.os != "iOS":
self.cpp_info.requires.append("qt::qtPrintSupport")
if qt_major == 5 and is_apple_os(self):
self.cpp_info.frameworks.extend(["qtMacExtras"])
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
From: SVN-Git Migration <[email protected]>
Date: Thu, 8 Oct 2015 13:39:18 -0700
Subject: remove-logo-privacy-issue.diff

Remove use of http://www.scintilla.org/SciBreak.jpg when the SCintilla docs
are accessed to resolve privacy-breach-logo lintian error. Not forwarded, not
needed.

Patch-Name: remove-logo-privacy-issue.diff
---
doc/Scintilla/index.html | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/doc/Scintilla/index.html b/doc/Scintilla/index.html
index 208b1ce..2831ab5 100644
--- a/doc/Scintilla/index.html
+++ b/doc/Scintilla/index.html
@@ -64,13 +64,6 @@
</td>
</tr>
</table>
- <table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td width="100%" style="background: url(https://www.scintilla.org/SciBreak.jpg) no-repeat;height:150px;">
- &nbsp;
- </td>
- </tr>
- </table>
<ul id="versionlist">
<li>Version 3.7.5 adds a Reverse Selected Lines command.
MSVC 2013 is no longer supported.</li>
@@ -177,15 +170,14 @@ hosted on
<!--
if (IsRemote()) {
document.write('<a href="https://sourceforge.net/projects/scintilla/">');
- document.write('<img src="https://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> ');
} else {
document.write('<a href="https://sourceforge.net/projects/scintilla/">SourceForge<\/a>');
}
//-->
</script>
<noscript>
-<a href="https://sourceforge.net/projects/scintilla/">
-<img src="https://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a>
+<a href="http://sourceforge.net/projects/scintilla">
+Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads</a>
</noscript>
</body>
</html>
33 changes: 33 additions & 0 deletions recipes/qscintilla/all/patches/0010-Add-import-QUrl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From: "Gudjon I. Gudjonsson" <[email protected]>
Date: Mon, 26 Aug 2019 06:49:17 +0200
Subject: Add import QUrl

---
src/Qsci/qsciscintilla.h | 1 +
src/Qsci/qsciscintillabase.h | 1 +
2 files changed, 2 insertions(+)

diff --git a/src/Qsci/qsciscintilla.h b/src/Qsci/qsciscintilla.h
index c8f1eee..31a5529 100644
--- a/src/Qsci/qsciscintilla.h
+++ b/src/Qsci/qsciscintilla.h
@@ -22,6 +22,7 @@
#ifndef QSCISCINTILLA_H
#define QSCISCINTILLA_H

+#include <QUrl>
#include <QByteArray>
#include <QList>
#include <QObject>
diff --git a/src/Qsci/qsciscintillabase.h b/src/Qsci/qsciscintillabase.h
index a253b11..1b1f8b6 100644
--- a/src/Qsci/qsciscintillabase.h
+++ b/src/Qsci/qsciscintillabase.h
@@ -23,6 +23,7 @@

#include <qglobal.h>

+#include <QUrl>
#include <QAbstractScrollArea>
#include <QByteArray>
#include <QPoint>
8 changes: 8 additions & 0 deletions recipes/qscintilla/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

find_package(qscintilla REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE qscintilla::qscintilla)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
26 changes: 26 additions & 0 deletions recipes/qscintilla/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)

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

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")
7 changes: 7 additions & 0 deletions recipes/qscintilla/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <Qsci/qsciscintilla.h>

void dummy() {
QsciScintilla editor;
}

int main() { }
3 changes: 3 additions & 0 deletions recipes/qscintilla/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"2.14.1":
folder: all