Skip to content

Commit

Permalink
hugin-app: update to 2021.0.0
Browse files Browse the repository at this point in the history
- Fixed several runtime path problems, and deprecated finite() problem common with prior version.
- Use later version of Boost, 1.76
  • Loading branch information
bal-agates authored and mascguy committed Aug 19, 2022
1 parent 92cadfc commit 68694cb
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 164 deletions.
83 changes: 63 additions & 20 deletions graphics/hugin-app/Portfile
Expand Up @@ -9,8 +9,8 @@ PortGroup linear_algebra 1.0
PortGroup boost 1.0

name hugin-app
version 2019.2.0
revision 5
version 2021.0.0
revision 0
set branch [join [lrange [split ${version} .] 0 1] .]
categories graphics
maintainers {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
Expand All @@ -33,30 +33,29 @@ compiler.cxx_standard 2011

perl5.branches 5.34
wxWidgets.use wxWidgets-3.0-cxx11
boost.version 1.71
boost.version 1.76

checksums rmd160 d16c364779a48451b3b222a0dd0efa46535e6ddc \
sha256 8ba6bdfea246313f142f17f42e066c6888f51b72e4f8814b5e1c84ff56a95a3e \
size 10335030
checksums rmd160 0c661e3754dee747284af07d4f2b477f48759ad6 \
sha256 047aea8a7fa47844b34ef27c19d3b697e84939dcb1fdbbeb2c204621b66eead9 \
size 10333565

linalg.setup noveclibfort

# do not assume default values that MacPorts sets
patchfiles-append patch-no_default.diff

# in /usr/include/sys/termios.h, VT1 is defined as a number
patchfiles-append patch-terios.diff
# Remove deployment target. Make detecting MacPorts more robust through flag to
# support non-standard install location.
patchfiles-append patch-CMakeLists.txt.diff

# change how we look for OpenMP
patchfiles-append patch-find_openmp.diff
post-patch {
reinplace \
"s|___MACPORTS_FIND_OPENMP__|set(OPENMP_FOUND FALSE)|g" \
${worksrcpath}/CMakeLists.txt
}

# icon files are not installed
#patchfiles-append patch-icns.diff
#patchfiles-append patch-find_openmp.diff
#post-patch {
# reinplace \
# "s|___MACPORTS_FIND_OPENMP__|set(OPENMP_FOUND FALSE)|g" \
# ${worksrcpath}/CMakeLists.txt
#}

# Fix icons which were not getting installed for PTBatcherGUI.app and
# HuginStitchProject.app. No icon supplied for calibrate_lens_gui.app.
patchfiles-append patch-icns.diff
post-extract {
# icon files have strange permissions
system "chmod 0644 ${worksrcpath}/src/hugin1/hugin/*.icns"
Expand All @@ -71,6 +70,42 @@ post-extract {
}
}

# Change finite() -> isfinite(). finite() deprecated since C99 and no
# no longer in my libraries.
patchfiles-append patch-compiler.h.diff

# Corrects path for launching PTBatcherGUI.app from Hugin.app by removing
# MAC_SELF_CONTAINED_BUNDLE from #if condition. Existing code seems to work.
patchfiles-append patch-PanoPanel.cpp.diff

# In RunStichPanel.cpp adjust exe path. Solves problem with PTBatcherGUI.app
# finding nona. Otherwise path is set to bundle exe dir which only contains
# PTBatcherGUI exe.
post-patch {
reinplace \
"s|exePath(wxStandardPaths::Get().GetExecutablePath())|exePath(\"${prefix}/bin/\")|" \
${worksrcpath}/src/hugin1/base_wx/RunStitchPanel.cpp
}

# In hugin_executor.cpp adjust exe path. I am not sure what this affects
# (didn't solve PTBatcherGUI nona problem) but similar to above patch. Might
# affect HuginStitchProject.app which I haven't used.
post-patch {
reinplace \
"s|exePath(wxStandardPaths::Get().GetExecutablePath())|exePath(\"${prefix}/bin/\")|" \
${worksrcpath}/src/hugin1/executor/hugin_executor.cpp
}

# Update search path in Hugin.app (i.e. for cpfind, etc.).
patchfiles-append patch-huginApp.cpp.diff

# Adjust search path above if non-standard MacPorts install location.
post-patch {
reinplace \
"s|MACPORTS_BIN_PATH \"/opt/local/bin\"|MACPORTS_BIN_PATH \"${prefix}/bin\"|" \
${worksrcpath}/src/hugin1/hugin/huginApp.cpp
}

# do not find freeglut if installed
configure.pre_args-replace \
-DCMAKE_FIND_FRAMEWORK=LAST \
Expand All @@ -80,6 +115,14 @@ configure.pre_args-replace \
configure.args-append \
-DTIFF_INCLUDE_DIR=${prefix}/include

# Affects CMakeList.txt application bundle path.
configure.args-append \
-DMACPORTS=1

# Affects huginApp.cpp adding code to setup environment path.
configure.cppflags-append \
-DMACPORTS

depends_build-append port:pkgconfig

# see http://wiki.panotools.org/Development_of_Open_Source_tools#Dependencies
Expand Down
51 changes: 51 additions & 0 deletions graphics/hugin-app/files/patch-CMakeLists.txt.diff
@@ -0,0 +1,51 @@
--- CMakeLists.txt.orig 2022-02-09 13:12:54.000000000 -0600
+++ CMakeLists.txt 2022-02-09 13:16:20.000000000 -0600
@@ -16,7 +16,7 @@
endif()

if(APPLE)
- set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
+ #set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
if (MAC_SELF_CONTAINED_BUNDLE)
set(CMAKE_LIBRARY_PATH ${CMAKE_SOURCE_DIR}/mac/ExternalPrograms/repository/lib)
set(CMAKE_INCLUDE_PATH ${CMAKE_SOURCE_DIR}/mac/ExternalPrograms/repository/include ${CMAKE_SOURCE_DIR}/mac/ExternalPrograms/repository/bin)
@@ -425,12 +425,12 @@
ENDIF()

# Check for OpenMP
-IF(APPLE)
+#IF(APPLE)
#we need a special search routine for mac, see changes in file CMakeModules/FindOpenMPMac.cmake
- FIND_PACKAGE(OpenMPMac)
-ELSE()
- FIND_PACKAGE(OpenMP)
-ENDIF()
+ #FIND_PACKAGE(OpenMPMac)
+#ELSE()
+ set(OPENMP_FOUND FALSE)
+#ENDIF()
IF(OPENMP_FOUND)
MESSAGE(STATUS "Compiler supports OpenMP. Activating support for it.")
ADD_COMPILE_OPTIONS(${OpenMP_CXX_FLAGS})
@@ -559,13 +559,13 @@
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++ -lc++")
# setup bundle install prefix
IF (NOT MAC_SELF_CONTAINED_BUNDLE)
- IF (CMAKE_INSTALL_PREFIX STREQUAL "/opt/local")
+ IF (MACPORTS)
# MacPorts
SET(INSTALL_OSX_BUNDLE_DIR /Applications/MacPorts CACHE DOCSTRING "Install directory Hugin and HuginStitchProject application bundles")
- ELSE(CMAKE_INSTALL_PREFIX STREQUAL "/opt/local")
+ ELSE(MACPORTS)
# fink or other custom system.
SET(INSTALL_OSX_BUNDLE_DIR ${CMAKE_INSTALL_PREFIX}/Applications CACHE DOCSTRING "Install directory Hugin and HuginStitchProject application bundles")
- ENDIF(CMAKE_INSTALL_PREFIX STREQUAL "/opt/local")
+ ENDIF(MACPORTS)
MESSAGE("*** Will install application bundles in ${INSTALL_OSX_BUNDLE_DIR}, set INSTALL_OSX_BUNDLE_DIR to change the location")
ENDIF (NOT MAC_SELF_CONTAINED_BUNDLE)
ENDIF (APPLE)
@@ -973,4 +973,3 @@

ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
-
16 changes: 16 additions & 0 deletions graphics/hugin-app/files/patch-PanoPanel.cpp.diff
@@ -0,0 +1,16 @@
--- ./src/hugin1/hugin/PanoPanel.cpp.orig 2022-02-08 13:38:30.000000000 -0600
+++ ./src/hugin1/hugin/PanoPanel.cpp 2022-02-08 13:33:13.000000000 -0600
@@ -1271,7 +1271,7 @@
return;
};

-#if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
+#if defined __WXMAC__
wxString cmd = MacGetPathToMainExecutableFileOfRegisteredBundle(CFSTR("net.sourceforge.hugin.PTBatcherGUI"));
if(cmd != wxT(""))
{
@@ -1786,4 +1786,3 @@
}

IMPLEMENT_DYNAMIC_CLASS(PanoPanelXmlHandler, wxXmlResourceHandler)
-
23 changes: 23 additions & 0 deletions graphics/hugin-app/files/patch-compiler.h.diff
@@ -0,0 +1,23 @@
--- src/foreign/levmar/compiler.h.orig 2010-12-02 04:30:11.000000000 -0600
+++ src/foreign/levmar/compiler.h 2022-02-03 08:12:52.000000000 -0600
@@ -20,6 +20,8 @@
#ifndef _COMPILER_H_
#define _COMPILER_H_

+#include <math.h>
+
/* note: intel's icc defines both __ICC & __INTEL_COMPILER.
* Also, some compilers other than gcc define __GNUC__,
* therefore gcc should be checked last
@@ -33,9 +35,9 @@
#ifdef _MSC_VER
#define LM_FINITE _finite // MSVC
#elif defined(__ICC) || defined(__INTEL_COMPILER) || defined(__GNUC__)
-#define LM_FINITE finite // ICC, GCC
+#define LM_FINITE isfinite // ICC, GCC
#else
-#define LM_FINITE finite // other than MSVC, ICC, GCC, let's hope this will work
+#define LM_FINITE isfinite // other than MSVC, ICC, GCC, let's hope this will work
#endif

#ifdef _MSC_VER
22 changes: 22 additions & 0 deletions graphics/hugin-app/files/patch-huginApp.cpp.diff
@@ -0,0 +1,22 @@
--- src/hugin1/hugin/huginApp.cpp.orig 2022-02-09 09:04:40.000000000 -0600
+++ src/hugin1/hugin/huginApp.cpp 2022-02-09 12:11:51.000000000 -0600
@@ -205,6 +205,19 @@
// display always the file type list
wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES, 1);
#endif
+#ifdef MACPORTS
+ // On macOS when Hugin.app is run from an application bundle the environment
+ // path doesn't inherit from the user and is set to something very limiting.
+ // Append the standard MacPorts bin location so functions like cpfind can be
+ // found. The environment path gets used in AutoCtrlPointCreator.cpp method
+ // AutoCtrlPointCreator::automatch(...).
+ #define MACPORTS_BIN_PATH "/opt/local/bin" /* Portfile may adjust */
+ wxString env_path;
+ wxGetEnv("PATH", &env_path);
+ env_path += ":";
+ env_path += MACPORTS_BIN_PATH;
+ wxSetEnv("PATH", env_path);
+#endif

// register our custom pano tools dialog handlers
registerPTWXDlgFcn();
45 changes: 0 additions & 45 deletions graphics/hugin-app/files/patch-no_default.diff

This file was deleted.

99 changes: 0 additions & 99 deletions graphics/hugin-app/files/patch-terios.diff

This file was deleted.

0 comments on commit 68694cb

Please sign in to comment.