1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

rawtherapee: fix exit SIGABRT, enable OpenMP/i386

Backport 'Explicitly destroy static Glib::RefPtr<>s on exit' from
Hombre57's hidpi-icons branch in GitHub (now merged to dev branch).
Also expose pixbufCache globally and explicitly .clear() it before exit().
Fixes the SIGABRT-on-exit issue.

Remove the wrapper that runs ulimit -c 0 before rawtherapee.

Enable OpenMP on i386 (uses GCC for now).

Shorten option descriptions so they don't get truncated.

Only add -msse2 on i386 and amd64, to fix broken aarch64/powerpc64 builds.

Fix various portlint warnings, removing USE_LDCONFIG.

PR:		205370
This commit is contained in:
Matthias Andree 2019-03-23 23:08:49 +00:00
parent eb07c6c18f
commit 6002f358f4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=496692
5 changed files with 190 additions and 40 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= rawtherapee PORTNAME= rawtherapee
PORTVERSION= 5.5 PORTVERSION= 5.5
PORTREVISION= 1
#DISTNAME= ${PORTNAME}-${PORTVERSION:R}-r${PORTVERSION:E}${DISTVERSIONSUFFIX} #DISTNAME= ${PORTNAME}-${PORTVERSION:R}-r${PORTVERSION:E}${DISTVERSIONSUFFIX}
CATEGORIES= graphics CATEGORIES= graphics
MASTER_SITES= http://rawtherapee.com/shared/source/ MASTER_SITES= http://rawtherapee.com/shared/source/
@ -29,14 +30,14 @@ LIB_DEPENDS= \
USES= cmake desktop-file-utils gnome dos2unix \ USES= cmake desktop-file-utils gnome dos2unix \
jpeg localbase:ldflags pkgconfig tar:xz jpeg localbase:ldflags pkgconfig tar:xz
DOS2UNIX_REGEX= .*\.(cc|h) DOS2UNIX_REGEX= .*\.(cc|h)
LDFLAGS+= -Wl,--as-needed # fontconfig, freetype, gettext, libX11 LDFLAGS+= -Wl,--as-needed # fontconfig, freetype, gettext, libX11
USE_GNOME= gtkmm30 USE_GNOME= gtkmm30
USE_LDCONFIG= yes
# The -D_GLIBCXX_USE_C99 works around stoi not being defined # The -D_GLIBCXX_USE_C99 works around stoi not being defined by default,
# by default because the GCC headers believe FreeBSD insufficiently C99 # because the GCC headers believe FreeBSD insufficiently C99 compliant.
# compliant. CFLAGS+= -I${LOCALBASE}/include -fPIC -D_GLIBCXX_USE_C99 -Wno-deprecated-declarations -Wno-unused-result -Wno-overloaded-virtual
CFLAGS+= -I${LOCALBASE}/include -fPIC -D_GLIBCXX_USE_C99 -Wno-deprecated-declarations -Wno-unused-result
LDFLAGS+= -lpthread LDFLAGS+= -lpthread
CMAKE_ARGS+= -DDOCDIR="${DOCSDIR}" \ CMAKE_ARGS+= -DDOCDIR="${DOCSDIR}" \
-DCREDITSDIR="${DOCSDIR}" \ -DCREDITSDIR="${DOCSDIR}" \
@ -51,8 +52,6 @@ CMAKE_ARGS+= -DDOCDIR="${DOCSDIR}" \
# linker flags are passed. Else -lomp is not found with clang. # linker flags are passed. Else -lomp is not found with clang.
# See: https://cmake.org/cmake/help/v3.4/policy/CMP0056.html # See: https://cmake.org/cmake/help/v3.4/policy/CMP0056.html
SUB_FILES= run-rawtherapee
INSTALLS_ICONS= yes INSTALLS_ICONS= yes
.if defined(PACKAGE_BUILDING) && empty(CFLAGS:M-march*) .if defined(PACKAGE_BUILDING) && empty(CFLAGS:M-march*)
@ -63,25 +62,19 @@ RTDIR= ${PREFIX}/libdata/${PORTNAME}
OPTIONS_DEFINE= DOCS OPTIMIZED_CFLAGS OPENMP NATIVE OPTIONS_DEFINE= DOCS OPTIMIZED_CFLAGS OPENMP NATIVE
OPTIONS_DEFAULT= OPTIMIZED_CFLAGS OPENMP OPTIONS_DEFAULT= OPTIMIZED_CFLAGS OPENMP
OPENMP_DESC= Enable multicore processing using OpenMP (amd64) OPENMP_DESC= Enable OpenMP parallel processing (i386/amd64 only)
OPTIMIZED_CFLAGS_DESC= Use extra compiler optimizations (requires SSE2 support) OPTIMIZED_CFLAGS_DESC= Use extra optimizations (needs SSE2 on i386/amd64)
NATIVE_DESC= Use -march=native for compilation (do not use for generic packages!) NATIVE_DESC= Use -march=native (avoid for generic packages!)
OPENMP_CMAKE_BOOL= OPTION_OMP OPENMP_CMAKE_BOOL= OPTION_OMP
OPTIMIZED_CFLAGS_CFLAGS= -O3 -funroll-loops -msse2
# GCC 5.4 includes -fexpensive-optimizations in -O2 already
.include <bsd.port.options.mk> .include <bsd.port.options.mk>
# ------------------------------------------------------------------- # -------------------------------------------------------------------
# #
BROKEN_aarch64= fails to build: gcc5: error: unrecognized command line option -msse2
BROKEN_powerpc64= fails to build: gcc6: error: unrecognized command line option -msse2
.if ${OPSYS} == FreeBSD .if ${OPSYS} == FreeBSD
.if ${OSVERSION} >= 1200000 .if ${OSVERSION} >= 1300000
# don't waste everybody's time with Tier-2 and moving targets. # don't waste everybody's time with Tier-2 and moving targets.
# might add ARM64 or SPARC64 later on if they are established by the # might add ARM64 or SPARC64 later on if they are established by the
# time FreeBSD 12 is out. # time FreeBSD 12 is out.
@ -94,8 +87,8 @@ ONLY_FOR_ARCHS_REASON=Only amd64 is supported on non-released FreeBSD versions.
CMAKE_ARGS+= -DPROC_TARGET_NUMBER="2" CMAKE_ARGS+= -DPROC_TARGET_NUMBER="2"
.endif .endif
.if !empty(PORT_OPTIONS:MOPENMP) && ${ARCH} == "amd64" .if !empty(PORT_OPTIONS:MOPENMP) && (${ARCH} == "amd64" || ${ARCH} == "i386")
LIB_DEPENDS+= libomp.so.0:devel/openmp LIB_DEPENDS+= libomp.so:devel/openmp
OPENMP_FLAGS= -lm -lomp OPENMP_FLAGS= -lm -lomp
LDFLAGS+= ${OPENMP_FLAGS} LDFLAGS+= ${OPENMP_FLAGS}
.endif .endif
@ -105,7 +98,12 @@ STRIP=
.endif .endif
.if ${ARCH} == i386 .if ${ARCH} == i386
. if ${PORT_OPTIONS:MOPENMP}
# OpenMP + clang on i386 will miss atomic ops => use GCC
USES+= compiler:gcc-c++11-lib
. else
USES+= compiler:c++11-lib USES+= compiler:c++11-lib
. endif
# If we were to use GCC on i386, we'd need to use -mstackrealign # If we were to use GCC on i386, we'd need to use -mstackrealign
# or similar options, else we get SIGBUS when SSE2 is enabled due to # or similar options, else we get SIGBUS when SSE2 is enabled due to
# improper alignment. Base clang is good enough though, i386 does not # improper alignment. Base clang is good enough though, i386 does not
@ -115,6 +113,14 @@ USES+= compiler:c++11-lib
USES+= compiler:c++14-lang USES+= compiler:c++14-lang
.endif .endif
.if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
CFLAGS+= -O3 -funroll-loops
# GCC 5.4 includes -fexpensive-optimizations in -O2 already
. if (${ARCH} == i386) || (${ARCH} == amd64)
CFLAGS+= -msse2
. endif
.endif
# ------------------------------------------------------------------- # -------------------------------------------------------------------
.include <bsd.port.pre.mk> .include <bsd.port.pre.mk>
@ -134,15 +140,10 @@ post-patch:
# shared libraries (this hinges on proper RPATH setting and propagation) # shared libraries (this hinges on proper RPATH setting and propagation)
post-install: post-install:
@${ECHO_MSG} "===> Running smoke tests" @${ECHO_MSG} "===> Running smoke tests"
@TMP=$$(mktemp -d -t ${PORTNAME}) && trap "rc=$$? ; rm -rf \"$$TMP\" ; exit \$$rc" 0 && \ @TMP=$$(mktemp -d -t ${PORTNAME}) && trap "rc=$$? ; ${RM} -rf \"$$TMP\" ; exit \$$rc" 0 && \
${SETENV} LANG= LC_ALL=C LANGUAGE= DISPLAY= HOME="$$TMP" ${STAGEDIR}${PREFIX}/bin/rawtherapee --help 2>&1 \ ${SETENV} LANG= LC_ALL=C LANGUAGE= DISPLAY= HOME="$$TMP" ${STAGEDIR}${PREFIX}/bin/rawtherapee --help 2>&1 \
| ${EGREP} -q "RawTherapee, version ${PKGVERSION:C/_.*//:C/,.*//}|cannot open display:" && \ | ${EGREP} -q "RawTherapee, version ${PKGVERSION:C/_.*//:C/,.*//}|cannot open display:" && \
${SETENV} LANG= LC_ALL=C LANGUAGE= DISPLAY= HOME="$$TMP" ${STAGEDIR}${PREFIX}/bin/rawtherapee-cli --version 2>&1 \ ${SETENV} LANG= LC_ALL=C LANGUAGE= DISPLAY= HOME="$$TMP" ${STAGEDIR}${PREFIX}/bin/rawtherapee-cli --version 2>&1 \
| ${EGREP} -q "RawTherapee, version ${PKGVERSION:C/_.*//:C/,.*//}" | ${EGREP} -q "RawTherapee, version ${PKGVERSION:C/_.*//:C/,.*//}"
@${ECHO_MSG} "===> Wrapping rawtherapee to prevent core dumps unless \$$DEBUG is nonempty"
# wrap things in a script that prevents core dumps
${MV} ${STAGEDIR}${PREFIX}/bin/rawtherapee ${STAGEDIR}${PREFIX}/bin/rawtherapee.real
${INSTALL_SCRIPT} ${WRKDIR}/run-rawtherapee ${STAGEDIR}${PREFIX}/bin/rawtherapee
.include <bsd.port.post.mk> .include <bsd.port.post.mk>

View File

@ -0,0 +1,164 @@
--- rtgui/cursormanager.cc.orig 2019-03-23 13:04:21 UTC
+++ rtgui/cursormanager.cc
@@ -79,6 +79,29 @@ void CursorManager::init (Glib::RefPtr<Gdk::Window> ma
window = mainWindow;
}
+void CursorManager::cleanup()
+{
+ cAdd.reset();
+ cAddPicker.reset();
+ cCropDraw.reset();
+ cCrosshair.reset();
+ cHandClosed.reset();
+ cHandOpen.reset();
+ cEmpty.reset();
+ cMoveBL.reset();
+ cMoveBR.reset();
+ cMoveL.reset();
+ cMoveR.reset();
+ cMoveTL.reset();
+ cMoveTR.reset();
+ cMoveX.reset();
+ cMoveY.reset();
+ cMoveXY.reset();
+ cRotate.reset();
+ cWB.reset();
+ cWait.reset();
+}
+
/* Set the cursor of the given window */
void CursorManager::setCursor (Glib::RefPtr<Gdk::Window> window, CursorShape shape)
{
--- rtgui/cursormanager.h.orig 2019-03-23 13:04:21 UTC
+++ rtgui/cursormanager.h
@@ -82,6 +82,7 @@ class CursorManager (private)
public:
void init (Glib::RefPtr<Gdk::Window> mainWindow);
+ void cleanup ();
static void setWidgetCursor (Glib::RefPtr<Gdk::Window> window, CursorShape shape);
static void setCursorOfMainWindow (Glib::RefPtr<Gdk::Window> window, CursorShape shape);
};
--- rtgui/filmsimulation.cc.orig 2019-03-23 13:04:21 UTC
+++ rtgui/filmsimulation.cc
@@ -262,10 +262,17 @@ void ClutComboBox::setBatchMode(bool yes)
}
+void ClutComboBox::cleanup()
+{
+ cm.reset();
+ cm2.reset();
+}
+
+
void ClutComboBox::updateUnchangedEntry()
{
auto c = m_model()->children();
-
+
if (batchMode) {
if (c.empty() || c[c.size()-1][m_columns().clutFilename] != "NULL") {
Gtk::TreeModel::Row row = *(m_model()->append());
--- rtgui/filmsimulation.h.orig 2019-03-23 13:04:21 UTC
+++ rtgui/filmsimulation.h
@@ -18,6 +18,8 @@ class ClutComboBox : public MyComboBox (public)
void setSelectedClut( Glib::ustring filename );
void setBatchMode(bool yes);
+ static void cleanup();
+
private:
void updateUnchangedEntry(); // in batchMode we need to add an extra entry "(Unchanged)". We do this whenever the widget is mapped (connecting to signal_map()), unless options.multiDisplayMode (see the comment below about cm2 in this case)
--- rtgui/guiutils.cc.orig 2019-03-23 13:04:21 UTC
+++ rtgui/guiutils.cc
@@ -560,6 +560,15 @@ void MyExpander::init()
closedPBuf = Gdk::Pixbuf::create_from_file(rtengine::findIconAbsolutePath("expander-closed-small.png"));
}
+void MyExpander::cleanup()
+{
+ inconsistentPBuf.reset();
+ enabledPBuf.reset();
+ disabledPBuf.reset();
+ openedPBuf.reset();
+ closedPBuf.reset();
+}
+
MyExpander::MyExpander(bool useEnabled, Gtk::Widget* titleWidget) :
enabled(false), inconsistent(false), flushEvent(false), expBox(nullptr),
child(nullptr), headerWidget(nullptr), statusImage(nullptr),
--- rtgui/guiutils.h.orig 2019-03-23 13:04:21 UTC
+++ rtgui/guiutils.h
@@ -228,6 +228,7 @@ class MyExpander : public Gtk::VBox (public)
/// Initialize the class by loading the images
static void init();
+ static void cleanup();
Glib::SignalProxy1< bool, GdkEventButton* > signal_button_release_event()
{
--- rtgui/main.cc.orig 2019-03-23 15:29:41 UTC
+++ rtgui/main.cc
@@ -673,5 +673,7 @@ int main (int argc, char **argv)
#endif
+ ns_RTImage::pixbufCache.clear();
+
return ret;
}
--- rtgui/rtimage.cc.orig 2019-03-23 13:04:21 UTC
+++ rtgui/rtimage.cc
@@ -25,12 +25,9 @@
#include "options.h"
#include "../rtengine/icons.h"
-namespace
-{
+using namespace ns_RTImage;
-std::map<std::string, Glib::RefPtr<Gdk::Pixbuf>> pixbufCache;
-
-}
+std::map<std::string, Glib::RefPtr<Gdk::Pixbuf>> ns_RTImage::pixbufCache;
RTImage::RTImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName) : Gtk::Image()
{
--- rtgui/rtimage.h.orig 2019-03-23 13:04:21 UTC
+++ rtgui/rtimage.h
@@ -23,6 +23,13 @@
class Options;
+namespace ns_RTImage
+{
+
+extern std::map<std::string, Glib::RefPtr<Gdk::Pixbuf>> pixbufCache;
+
+}
+
/**
* @brief A derived class of Gtk::Image in order to handle theme-related icon sets.
*/
--- rtgui/rtwindow.cc.orig 2019-03-23 13:04:21 UTC
+++ rtgui/rtwindow.cc
@@ -708,6 +708,16 @@ bool RTWindow::on_delete_event (GdkEventAny* event)
cacheMgr->closeCache (); // also makes cleanup if too large
WhiteBalance::cleanup();
ProfilePanel::cleanup();
+ ClutComboBox::cleanup();
+ MyExpander::cleanup();
+ mainWindowCursorManager.cleanup();
+ editWindowCursorManager.cleanup();
+ BatchQueueEntry::savedAsIcon.reset();
+ FileBrowserEntry::editedIcon.reset();
+ FileBrowserEntry::recentlySavedIcon.reset();
+ FileBrowserEntry::enqueuedIcon.reset();
+ FileBrowserEntry::hdr.reset();
+ FileBrowserEntry::ps.reset();
if (!options.windowMaximized) {
get_size (options.windowWidth, options.windowHeight);

View File

@ -1,6 +0,0 @@
#!/bin/sh
# suppress core files unless DEBUG variable is set
if test -z "$DEBUG" ; then
ulimit -c 0
fi
exec "%%PREFIX%%/bin/rawtherapee.real" "$@"

View File

@ -9,11 +9,3 @@ remove older cache directories.
Also, after configurations have been moved to the new version's Also, after configurations have been moved to the new version's
directory, older $HOME/.config/RawTherapee* directories may be removed. directory, older $HOME/.config/RawTherapee* directories may be removed.
======================================================================= =======================================================================
Also, due to a bug that has not yet been found, RawTherapee will
cause an abort trap when shutting down. rawtherapee is now installed
as rawtherapee.real, and rawtherapee is a wrapper script that will
prevent the creation of a core file in this situation, unless the
environment variable DEBUG is set and not empty.
-> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205370
-> https://github.com/Beep6581/RawTherapee/issues/3636
=======================================================================

View File

@ -1,6 +1,5 @@
@comment env LC_ALL=C sort -f @comment env LC_ALL=C sort -f
bin/rawtherapee bin/rawtherapee
bin/rawtherapee.real
bin/rawtherapee-cli bin/rawtherapee-cli
man/man1/rawtherapee.1.gz man/man1/rawtherapee.1.gz
share/applications/rawtherapee.desktop share/applications/rawtherapee.desktop