Skip to content

Commit

Permalink
x11-toolkits/copperspice: resurrect CopperSpice
Browse files Browse the repository at this point in the history
CopperSpice is a toolkit, forked from Qt and updated to use
modern C++ and CMake in the Qt 5.something LGPL days. It was
removed from the tree for being unfetchable in 2017, now
restored. I didn't bother to look at the old ports files, so
this is entirely new work.

CS builds cleanly, except I patched in -pthread as a linker
option; I think this ought to be part of the Threads package
found by CMake, but it isn't (on FreeBSD at least). Some linkage
options need to be PUBLIC to be carried through to consuming
applications (this is a FreeBSD thing).

While here, introduce the misc/copperspice-examples which
is a demo application *kitchensink* that exercises the libraries.

CopperSpice shares notional-filenames with Qt (e.g. binaries
called "lupdate" for UI design) but the Qt ports are versioned
("lupdate-qt5"). CopperSpice gets "-cs" as a suffix.

There's a bunch of patching to make things "behave" like a
regularly packaged set of libraries and applications that
consume those libraries. In particular using $(LOCALBASE)/share/
rather than putting everything in the same target directory.
  • Loading branch information
Adriaan de Groot authored and Adriaan de Groot committed Feb 20, 2022
1 parent fb02dbd commit 8de46b4
Show file tree
Hide file tree
Showing 40 changed files with 2,789 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MOVED
Original file line number Diff line number Diff line change
Expand Up @@ -13107,7 +13107,6 @@ games/xscorch||2019-10-16|Has expired: Unfetchable, unmaintained
graphics/aeskulap||2019-10-16|Has expired: Unfetchable, unmaintained
graphics/agave||2019-10-16|Has expired: Unfetchable, unmaintained
graphics/cbview||2019-10-16|Has expired: Unfetchable, unmaintained
graphics/copperspice||2019-10-16|Has expired: Unfetchable, unmaintained
graphics/cthumb||2019-10-16|Has expired: Unfetchable, unmaintained
graphics/fujiplay||2019-10-16|Has expired: Unfetchable, unmaintained
graphics/gimp-ez-perspective-plugin||2019-10-16|Has expired: Unfetchable, unmaintained
Expand Down Expand Up @@ -16892,3 +16891,4 @@ security/php81-openssl||2022-02-12|php81-openssl module is a default module for
math/qhull8|math/qhull|2022-02-19|qhull as version 8 is the default from now on
print/tex-aleph||2022-02-19|tex-aleph has been removed from texlive-2021 system
sysutils/intel-pcm-devel||2022-02-19|intel-pcm-devel has been removed, encouraging users to use intel-pcm instead
graphics/copperspice|x11-toolkits/copperspice|2022-02-20|Revive in more appropriate category
1 change: 1 addition & 0 deletions misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
SUBDIR += compat8x
SUBDIR += compat9x
SUBDIR += concourse
SUBDIR += copperspice-examples
SUBDIR += countrycodes
SUBDIR += cpuid
SUBDIR += crosti
Expand Down
38 changes: 38 additions & 0 deletions misc/copperspice-examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
PORTNAME= copperspice-examples
DISTVERSIONPREFIX= ks-
DISTVERSION= 1.7.3
CATEGORIES= misc

MAINTAINER= adridg@FreeBSD.org
COMMENT= Example programs for Copperspice

LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE

LIB_DEPENDS= libasound.so:audio/alsa-lib \
libpulse.so:audio/pulseaudio \
libgstreamer-1.0.so:multimedia/gstreamer1 \
libcups.so:print/cups \
libxcb-icccm.so:x11/xcb-util-wm \
libxcb-image.so:x11/xcb-util-image \
libxcb-keysyms.so:x11/xcb-util-keysyms \
libxcb-render-util.so:x11/xcb-util-renderutil \
libxcb.so:x11/libxcb \
libxkbcommon.so:x11/libxkbcommon \
libfontconfig.so:x11-fonts/fontconfig
BUILD_DEPENDS= copperspice>=1.7:x11-toolkits/copperspice
RUN_DEPENDS= copperspice>=1.7:x11-toolkits/copperspice

USES= compiler:c++17-lang cmake gl gnome iconv jpeg pkgconfig ssl xorg
USE_GL= gl
USE_GNOME= cairo glib20 libxml2
USE_GSTREAMER1= yes
USE_XORG= ice sm x11 xau xcb xcursor xext xfixes xi xinerama xrandr xrender

USE_GITHUB= yes
GH_ACCOUNT= copperspice
GH_PROJECT= kitchensink

PLIST_FILES= bin/kitchensink

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions misc/copperspice-examples/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TIMESTAMP = 1644188375
SHA256 (copperspice-kitchensink-ks-1.7.3_GH0.tar.gz) = 5e7f8cab97e6260ad6dc7e1195ef7983bb4ecf88c47047196ad48e8bf7690c3d
SIZE (copperspice-kitchensink-ks-1.7.3_GH0.tar.gz) = 626928
62 changes: 62 additions & 0 deletions misc/copperspice-examples/files/patch-src_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--- src/CMakeLists.txt.orig 2022-02-15 21:15:36 UTC
+++ src/CMakeLists.txt
@@ -182,25 +182,26 @@ endif()
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
install(TARGETS KitchenSink DESTINATION ../MacOS)
else()
- install(TARGETS KitchenSink DESTINATION .)
+ install(TARGETS KitchenSink)
endif()

-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../resources/script.js DESTINATION ./resources)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../resources/sampleMenu.xml DESTINATION ./resources)
+set(install_resource_dir ${CMAKE_INSTALL_DATADIR}/copperspice/kitchensink/resources)
+# install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../resources/script.js DESTINATION ${install_resource_dir})
+# install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../resources/sampleMenu.xml DESTINATION ${install_resource_dir})

# installs the CopperSpice libraries
-cs_copy_library(CsCore)
-cs_copy_library(CsGui)
-cs_copy_library(CsNetwork)
-cs_copy_library(CsOpenGL)
-cs_copy_library(CsScript)
-cs_copy_library(CsSql)
-cs_copy_library(CsSvg)
-cs_copy_library(CsXml)
-cs_copy_library(CsXmlPatterns)
+# cs_copy_library(CsCore)
+# cs_copy_library(CsGui)
+# cs_copy_library(CsNetwork)
+# cs_copy_library(CsOpenGL)
+# cs_copy_library(CsScript)
+# cs_copy_library(CsSql)
+# cs_copy_library(CsSvg)
+# cs_copy_library(CsXml)
+# cs_copy_library(CsXmlPatterns)

if("Multimedia" IN_LIST COPPERSPICE_COMPONENTS)
- cs_copy_library(CsMultimedia)
+ # cs_copy_library(CsMultimedia)
endif()

if("WebKit" IN_LIST COPPERSPICE_COMPONENTS)
@@ -226,15 +227,15 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
elseif(CMAKE_SYSTEM_NAME MATCHES "(Linux|OpenBSD|FreeBSD|NetBSD|DragonFly)")

# installs the platform Gui plugin
- cs_copy_plugins(CsGui)
- cs_copy_plugins(CsOpenGL)
+ # cs_copy_plugins(CsGui)
+ # cs_copy_plugins(CsOpenGL)

# three files
if("Multimedia" IN_LIST COPPERSPICE_COMPONENTS)
- cs_copy_plugins(CsMultimedia)
+ # cs_copy_plugins(CsMultimedia)
endif()

- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../resources/ks.png DESTINATION ./resources)
+ # install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../resources/ks.png DESTINATION ${install_resource_dir})

elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")

5 changes: 5 additions & 0 deletions misc/copperspice-examples/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CopperSpice is a set of individual libraries which can be used to develop
cross platform software applications in C++. This is the example application
for CopperSpice, which showcases most of the things the library can do.

WWW: https://www.copperspice.com/
1 change: 1 addition & 0 deletions x11-toolkits/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
SUBDIR += blt
SUBDIR += bwidget
SUBDIR += color-widgets-qt5
SUBDIR += copperspice
SUBDIR += ctk
SUBDIR += fltk
SUBDIR += fox14
Expand Down
46 changes: 46 additions & 0 deletions x11-toolkits/copperspice/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
PORTNAME= copperspice
DISTVERSIONPREFIX= cs-
DISTVERSION= 1.7.3
CATEGORIES= x11-toolkits

MAINTAINER= adridg@FreeBSD.org
COMMENT= First class GUI library to unite the C++ community

LICENSE= LGPL21
LICENSE_FILE= ${WRKSRC}/license/LICENSE.LGPL

LIB_DEPENDS= libasound.so:audio/alsa-lib \
libpulse.so:audio/pulseaudio \
libgstreamer-1.0.so:multimedia/gstreamer1 \
libcups.so:print/cups \
libxcb-icccm.so:x11/xcb-util-wm \
libxcb-image.so:x11/xcb-util-image \
libxcb-keysyms.so:x11/xcb-util-keysyms \
libxcb-render-util.so:x11/xcb-util-renderutil \
libxcb.so:x11/libxcb \
libxkbcommon.so:x11/libxkbcommon \
libfontconfig.so:x11-fonts/fontconfig

USES= compiler:c++17-lang cmake gl gnome iconv jpeg pkgconfig ssl xorg
USE_GL= gl
USE_GNOME= cairo glib20 libxml2
USE_GSTREAMER1= yes
USE_XORG= ice sm x11 xau xcb xcursor xext xfixes xi xinerama xrandr xrender

USE_GITHUB= yes

CMAKE_ARGS+= -DCMAKE_INSTALL_BINDIR:PATH='$(LOCALBASE)/lib/copperspice/bin' \
-DCMAKE_INSTALL_INCLUDEDIR:PATH='$(LOCALBASE)/include/copperspice' \
-DCMAKE_INSTALL_PREFIX:PATH='$(LOCALBASE)' \
-DTOOLS_SUFFIX:STRING=-cs

# There is a notional conflict with the Qt ports: those have **versioned**
# tool names, like designer-qt5, lupdate-qt5, to allow co-installation
# of Qt[456] (when we had / have more than one current-version in ports).
#
# Since CopperSpice doesn't version the binaries, it doesn't conflict
# with the Qt ports, but does "rudely" occupy the unversioned name.
#
# CONFLICTS= qt5-core

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions x11-toolkits/copperspice/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TIMESTAMP = 1644180687
SHA256 (copperspice-copperspice-cs-1.7.3_GH0.tar.gz) = c1c1318f04aae0e4af10fffa6d20267768c2b1acc4c339f41609629584f81c39
SIZE (copperspice-copperspice-cs-1.7.3_GH0.tar.gz) = 35455780
29 changes: 29 additions & 0 deletions x11-toolkits/copperspice/files/patch-CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- CMakeLists.txt.orig 2022-01-14 18:52:21 UTC
+++ CMakeLists.txt
@@ -43,12 +43,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
elseif (CMAKE_SYSTEM_NAME MATCHES "(Linux|OpenBSD|FreeBSD|NetBSD|DragonFly)")
include(GNUInstallDirs)

- # rpath used for rcc and uic when compiling a user application
- file(RELATIVE_PATH CS_BIN_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}"
- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
-
- set(CMAKE_INSTALL_RPATH "$ORIGIN/${CS_BIN_RPATH}")
-
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_INSTALL_BINDIR bin)
set(CMAKE_INSTALL_LIBDIR lib)
@@ -549,6 +543,13 @@ elseif (WITH_WEBKIT AND NOT (WITH_GUI AND WITH_NETWORK
message(SEND_ERROR "WebKit component requires Gui, Network, and Script components")

endif()
+
+# To improve co-installability, insert this subdirectory in library-
+# and include-file installation paths (e.g. libraries end up installed
+# in ${PREFIX}/lib/${CS_NAMESPACE_DIRECTORY}/ ) It may be empty,
+# for no intermediate subdirectory. If it isn't empty, must end with /.
+set(CS_NAMESPACE_DIRECTORY "/copperspice/")
+set(CS_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY})

add_subdirectory(src/core)
foreach(component ${CS_OPTIONAL_COMPONENTS})
36 changes: 36 additions & 0 deletions x11-toolkits/copperspice/files/patch-src_core_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--- src/core/CMakeLists.txt.orig 2022-01-14 18:52:21 UTC
+++ src/core/CMakeLists.txt
@@ -128,9 +128,10 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")

elseif(CMAKE_SYSTEM_NAME MATCHES "(OpenBSD|FreeBSD|NetBSD|DragonFly)")
target_link_libraries(CsCore
- PRIVATE
+ PUBLIC
${CMAKE_THREAD_LIBS_INIT}
)
+ target_link_options(CsCore PUBLIC -pthread)
include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/forkfd)

elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
@@ -154,8 +155,8 @@ target_sources(CsCore

target_include_directories(CsCore
PUBLIC
- $<INSTALL_INTERFACE:include>
- $<INSTALL_INTERFACE:include/QtCore>
+ ${CMAKE_INSTALL_INCLUDEDIR}
+ ${CMAKE_INSTALL_INCLUDEDIR}/QtCore
)

if(MSVC)
@@ -196,8 +197,8 @@ install(
TARGETS CsCore
EXPORT CopperSpiceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
)

install(
17 changes: 17 additions & 0 deletions x11-toolkits/copperspice/files/patch-src_core_kernel_kernel.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- src/core/kernel/kernel.cmake.orig 2022-02-17 22:27:19 UTC
+++ src/core/kernel/kernel.cmake
@@ -150,6 +150,7 @@ target_sources(CsCore
${CMAKE_CURRENT_SOURCE_DIR}/kernel/csobject_debug.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/csobject_private.cpp
)
+target_compile_definitions(CsCore PRIVATE CS_DEFAULT_PLUGINPATH="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}")

if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
target_sources(CsCore
@@ -194,4 +195,4 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsystemsemaphore_win.cpp
)

-endif()
\ No newline at end of file
+endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/core/kernel/qcoreapplication.cpp.orig 2022-02-17 22:23:09 UTC
+++ src/core/kernel/qcoreapplication.cpp
@@ -1653,6 +1653,8 @@ QStringList QCoreApplication::libraryPaths()
app_libpaths->append(canonicalPath);
}
}
+ } else { // Bung in the #defined default, which comes from CMake
+ QString canonicalPath = QDir(CS_DEFAULT_PLUGINPATH).canonicalPath(); if (! canonicalPath.isEmpty() && !app_libpaths->contains(canonicalPath)) app_libpaths->append(CS_DEFAULT_PLUGINPATH);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- src/declarative/CMakeLists.txt.orig 2022-01-14 18:52:21 UTC
+++ src/declarative/CMakeLists.txt
@@ -73,8 +73,8 @@ macro_generate_package(
install(TARGETS CsDeclarative
EXPORT CopperSpiceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
)

install(
22 changes: 22 additions & 0 deletions x11-toolkits/copperspice/files/patch-src_gui_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- src/gui/CMakeLists.txt.orig 2022-01-14 18:52:21 UTC
+++ src/gui/CMakeLists.txt
@@ -179,7 +179,7 @@ target_sources(CsGui

target_include_directories(CsGui
PUBLIC
- $<INSTALL_INTERFACE:include/QtGui>
+ ${CMAKE_INSTALL_INCLUDEDIR}/QtGui
${OPENGL_INCLUDE_DIR}
)

@@ -215,8 +215,8 @@ install(
TARGETS CsGui
EXPORT CopperSpiceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
)

install(
22 changes: 22 additions & 0 deletions x11-toolkits/copperspice/files/patch-src_multimedia_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- src/multimedia/CMakeLists.txt.orig 2022-01-14 18:52:21 UTC
+++ src/multimedia/CMakeLists.txt
@@ -81,7 +81,7 @@ target_link_libraries(CsMultimedia
target_include_directories(CsMultimedia
PUBLIC
${GSTREAMER_INCLUDE_DIRS}
- $<INSTALL_INTERFACE:include/QtMultimedia>
+ ${CMAKE_INSTALL_INCLUDEDIR}/QtMultimedia
)

set_target_properties(CsMultimedia
@@ -103,8 +103,8 @@ install(
TARGETS CsMultimedia
EXPORT CopperSpiceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
)

install(
22 changes: 22 additions & 0 deletions x11-toolkits/copperspice/files/patch-src_network_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- src/network/CMakeLists.txt.orig 2022-01-14 18:52:21 UTC
+++ src/network/CMakeLists.txt
@@ -92,7 +92,7 @@ target_link_libraries(CsNetwork

target_include_directories(CsNetwork
PUBLIC
- $<INSTALL_INTERFACE:include/QtNetwork>
+ ${CMAKE_INSTALL_INCLUDEDIR}/QtNetwork
)

set_target_properties(CsNetwork
@@ -114,8 +114,8 @@ install(
TARGETS CsNetwork
EXPORT CopperSpiceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
)

install(
22 changes: 22 additions & 0 deletions x11-toolkits/copperspice/files/patch-src_opengl_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- src/opengl/CMakeLists.txt.orig 2022-01-14 18:52:21 UTC
+++ src/opengl/CMakeLists.txt
@@ -130,7 +130,7 @@ function_variable_fixup("${EXTRA_OPENGL_LDFLAGS}" EXT

target_include_directories(CsOpenGL
PUBLIC
- $<INSTALL_INTERFACE:include/QtOpenGL>
+ ${CMAKE_INSTALL_INCLUDEDIR}/QtOpenGL
)

target_link_libraries(CsOpenGL
@@ -159,8 +159,8 @@ install(
TARGETS CsOpenGL
EXPORT CopperSpiceLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${CS_NAMESPACE_DIRECTORY}
)

install(
Loading

0 comments on commit 8de46b4

Please sign in to comment.