Skip to content

Commit

Permalink
octave: update to 7.1.0, fix aarm64 build
Browse files Browse the repository at this point in the history
fix pkg bug 62436, delete obsolete patchfiles
remove obsolete qt4 variant
  • Loading branch information
Schamschula committed May 29, 2022
1 parent 9d26d6e commit c5404c9
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 153 deletions.
74 changes: 30 additions & 44 deletions math/octave/Portfile
Expand Up @@ -7,9 +7,9 @@ PortGroup compiler_blacklist_versions 1.0
PortGroup linear_algebra 1.0

name octave
version 6.4.0
set package_version 6.x.x
revision 3
version 7.1.0
set package_version 7.x.x
revision 0

categories math science
platforms darwin
Expand All @@ -25,9 +25,9 @@ homepage https://www.gnu.org/software/octave

master_sites gnu:octave

checksums rmd160 a87deb19263af1546e27206238fb3ba2730f366b \
sha256 b48f33d4fceaf394cfbea73a8c850000936d83a41739a24f7568b5b0a7b39acd \
size 32873157
checksums rmd160 441b87175de45384e696e1721e62ed6a398d2e48 \
sha256 d4a9d81f3f67b4a6e07cb7a80dcb10ad5e9176fcc30762c70a81580a64b8b0b6 \
size 34187598

# see https://lists.gnu.org/archive/html/octave-maintainers/2016-05/msg00286.html
compiler.cxx_standard \
Expand Down Expand Up @@ -65,17 +65,6 @@ patchfiles-append patch-__opengl_info__.diff
# see https://trac.macports.org/ticket/57288
patchfiles-append patch-run-octave.diff

# find MacPorts Qt libraries
# fails to apply: patchfiles-append patch-link_location.diff

# fix CXXFLAGS when testing for Qt5 properties
# see https://trac.macports.org/ticket/58226
patchfiles-append patch-qt5-cxxflags.diff

# small fixes to allow Octave6 qt4 variant to build
# can be enabled at all times
patchfiles-append patch-octave6-qt4-fixes.diff

# see https://savannah.gnu.org/patch/index.php?9806
set java_version 1.8
patchfiles-append patch-java_version.diff
Expand All @@ -85,6 +74,10 @@ post-patch {
${worksrcpath}/Makefile.in
}

# pkg build fails if no configure file exists
# see https://savannah.gnu.org/bugs/?62436
patchfiles-append bug62436.patch

post-patch {
if { ${os.arch} eq "i386" } {
if { ${os.major} >= 9 && [sysctl hw.cpu64bit_capable] == 1 } {
Expand Down Expand Up @@ -418,14 +411,7 @@ variant java description {enable Java interface} {
# https://trac.macports.org/ticket/51480
#default_variants-append +java

variant qt4 conflicts qt5 description {build the GUI using Qt4} {
PortGroup qt4 1.0

depends_lib-append port:qscintilla-qt4 port:qt4-mac-sqlite3-plugin
configure.args-replace --without-qt --with-qt=4
}

variant qt5 conflicts qt4 description {build the GUI using Qt5} {
variant qt5 description {build the GUI using Qt5} {
PortGroup qt5 1.0

qt5.depends_component qttools sqlite-plugin
Expand All @@ -442,16 +428,14 @@ variant qt5 conflicts qt4 description {build the GUI using Qt5} {
destroot.env-append PATH=${qt_dir}/bin:$env(PATH)
test.env-append PATH=${qt_dir}/bin:$env(PATH)
}
if { ![variant_isset qt4] && ![variant_isset qt5] } {
if { ![variant_isset qt5] } {
# a somewhat arbitrary cutoff for default values
# Mac OS X 10.7 (Darwin 11) was the last OS supported by Qt 4
# see http://doc.qt.io/qt-4.8/supported-platforms.html
# OS X 10.10 (Darwin 14) is the oldest OS supported by the current long-term support version of Qt 5 (Qt 5.9).
# see http://web.archive.org/web/20170702143426/https://doc.qt.io/qt-5/supported-platforms-and-configurations.html
if {${os.major} >= 14 || ${os.platform} ne "darwin"} {
default_variants-append +qt5
} else {
default_variants-append +qt4
}
}

Expand All @@ -462,7 +446,7 @@ variant fltk description {enable fltk as a graphics toolkit for plotting} {
# see https://github.com/macports/macports-ports/pull/1865 for a discussion on fltk
#default_variants-append +fltk

if {[variant_isset fltk] || [variant_isset qt4] || [variant_isset qt5]} {
if {[variant_isset fltk] || [variant_isset qt5]} {
# native_graphics (fltk) and gui (Qt) require OpenGL and font and printing capabilities
depends_lib-append \
port:fontconfig \
Expand All @@ -472,14 +456,10 @@ if {[variant_isset fltk] || [variant_isset qt4] || [variant_isset qt5]} {
configure.args-replace --without-opengl --with-framework-opengl
}

if { ([variant_isset fltk] && [variant_isset qt4]) || ([variant_isset fltk] && [variant_isset qt5]) } {
if { [variant_isset fltk] && [variant_isset qt5] } {
notes-append "unless octave is run with --no-gui-libs, graphics_toolkit(\"fltk\") will cause a crash"
}

if {[variant_isset qt4]} {
notes-append "on-disk documentation is not building at present with qt4 variant, but online is available"
}

variant sound description {enable audio support (file I/O and playback)} {
depends_lib-append port:libsndfile
depends_lib-append port:portaudio
Expand All @@ -505,7 +485,7 @@ variant app description "build application bundle to launch ${subport}" {
xinstall -d -m 0755 ${worksrcpath}/${appName}/Contents/MacOS

set script [open "${worksrcpath}/${appName}/Contents/MacOS/Octave" w 0755]
if { [variant_isset qt4] || [variant_isset qt5] } {
if { [variant_isset qt5] } {
puts ${script} "#!/bin/sh"
puts ${script} ""
puts ${script} "${prefix}/bin/octave-${version} --gui \"\$@\""
Expand Down Expand Up @@ -577,14 +557,14 @@ variant app description "build application bundle to launch ${subport}" {
copy ${worksrcpath}/${appName} ${destroot}${applications_dir}
}
}
if {[variant_isset qt4] || [variant_isset qt5] } {
if { [variant_isset qt5] } {
default_variants-append +app
}


# the qt gui uses a few Objective-C calls, and for some reason
# libobjc.dylib is not being automatically linked in on older systems
if {[variant_isset qt4] || [variant_isset qt5] } {
if { [variant_isset qt5] } {
if { ${os.platform} eq "darwin" && ${os.major} < 18 } {
configure.ldflags-append -lobjc
}
Expand All @@ -608,10 +588,7 @@ variant docs description {build documentation files} {

configure.args-replace --disable-docs --enable-docs
}
# the documentation is not building when using qt4 at present
if {![variant_isset qt4]} {
default_variants-append +docs
}
default_variants-append +docs

# GraphicsMagick and octave need to be built with the same C++ standard library
# or else undefined symbols:
Expand All @@ -638,6 +615,15 @@ if {${magickDefault}} {
default_variants-append +graphicsmagick
}

post-build {
# fix @rpath for octave-cli
system "install_name_tool -change @rpath/libgfortran.5.dylib ${prefix}/lib/libgcc/libgfortran.5.dylib ${worksrcpath}/src/.libs/octave-cli"
system "install_name_tool -change @rpath/libquadmath.0.dylib ${prefix}/lib/libgcc/libquadmath.0.dylib ${worksrcpath}/src/.libs/octave-cli"
# fix @rpath for octave-gui
system "install_name_tool -change @rpath/libgfortran.5.dylib ${prefix}/lib/libgcc/libgfortran.5.dylib ${worksrcpath}/src/.libs/octave-gui"
system "install_name_tool -change @rpath/libquadmath.0.dylib ${prefix}/lib/libgcc/libquadmath.0.dylib ${worksrcpath}/src/.libs/octave-gui"
}

post-destroot {
# put any startup commands in ${destroot}${prefix}/share/octave/${version}/m/startup/octaverc
# see https://www.gnu.org/software/octave/doc/interpreter/Startup-Files.html
Expand All @@ -651,15 +637,15 @@ post-destroot {
}

# do not force upgrade of every dependency every time the version changes
foreach lib {liboctave.8.dylib liboctinterp.9.dylib} {
foreach lib {liboctave.9.dylib liboctinterp.10.dylib} {
xinstall -d -m 0755 ${destroot}${prefix}/lib/octave/${package_version}
ln -s ../${version}/${lib} ${destroot}${prefix}/lib/octave/${package_version}/${lib}
system "install_name_tool -id ${prefix}/lib/octave/${package_version}/${lib} ${destroot}${prefix}/lib/octave/${version}/${lib}"
}

if {[variant_isset qt4] || [variant_isset qt5]} {
if { [variant_isset qt5] } {
# do not force upgrade of every dependency every time the version changes
foreach lib {liboctgui.6.dylib} {
foreach lib {liboctgui.8.dylib} {
xinstall -d -m 0755 ${destroot}${prefix}/lib/octave/${package_version}
ln -s ../${version}/${lib} ${destroot}${prefix}/lib/octave/${package_version}/${lib}
system "install_name_tool -id ${prefix}/lib/octave/${package_version}/${lib} ${destroot}${prefix}/lib/octave/${version}/${lib}"
Expand Down
27 changes: 27 additions & 0 deletions math/octave/files/bug62436.patch
@@ -0,0 +1,27 @@
# HG changeset patch
# User John Donoghue <john.donoghue@ieee.org>
# Date 1652358904 14400
# Thu May 12 08:35:04 2022 -0400
# Branch stable
# Node ID 8c940cfcce257369677c09154da2aab2c56eaa79
# Parent 63710f3bd9811c2d206ac9e7b4f47cf06c47e153
* scripts/pkg/private/build.m: check configure and Makefile exist before trying to unlink them (Bug #62436)

diff -r 63710f3bd981 -r 8c940cfcce25 scripts/pkg/private/build.m
--- scripts/pkg/private/build.m Wed May 11 09:44:55 2022 -0700
+++ scripts/pkg/private/build.m Thu May 12 08:35:04 2022 -0400
@@ -77,8 +77,12 @@
else
arch_abi = getarch ();
configure_make (desc, build_root, verbose);
- unlink (fullfile (build_root, "src", "configure"));
- unlink (fullfile (build_root, "src", "Makefile"));
+ if exist (fullfile (build_root, "src", "configure"), "file")
+ unlink (fullfile (build_root, "src", "configure"));
+ endif
+ if exist (fullfile (build_root, "src", "Makefile"), "file")
+ unlink (fullfile (build_root, "src", "Makefile"));
+ endif
endif
tar_name = [desc.name "-" desc.version "-" arch_abi ".tar"];
tar_path = fullfile (builddir, tar_name);
13 changes: 0 additions & 13 deletions math/octave/files/patch-octave6-qt4-fixes.diff

This file was deleted.

74 changes: 0 additions & 74 deletions math/octave/files/patch-qt5-cxxflags.diff

This file was deleted.

44 changes: 22 additions & 22 deletions math/octave/files/patch-versions.diff
Expand Up @@ -11,71 +11,71 @@
man1ext="@man1ext@"
--- configure.orig 2019-03-03 07:08:47.000000000 -0700
+++ configure 2019-03-03 07:12:49.000000000 -0700
@@ -8191,7 +8191,7 @@
## This path usually includes the Octave version and configuration name, so
## that configurations for multiple versions of Octave may be installed at once.
@@ -8510,7 +8510,7 @@
;;
*)

- : ${archlibdir='${libexecdir}/octave/${version}/exec/${canonical_host_type}'}
+ : ${archlibdir='${libexecdir}/octave/${version}/exec/__MACPORTS_canonical_host_type__'}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defining archlibdir to be $archlibdir" >&5
$as_echo "defining archlibdir to be $archlibdir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defining archlibdir to be $archlibdir" >&5
printf "%s\n" "defining archlibdir to be $archlibdir" >&6; }

@@ -8200,21 +8200,21 @@
@@ -8520,21 +8520,21 @@
## Where to put executables to be run by Octave, rather than the user, that
## are specific to this site.

- : ${localarchlibdir='${libexecdir}/octave/site/exec/${canonical_host_type}'}
+ : ${localarchlibdir='${libexecdir}/octave/site/exec/__MACPORTS_canonical_host_type__'}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localarchlibdir to be $localarchlibdir" >&5
$as_echo "defining localarchlibdir to be $localarchlibdir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defining localarchlibdir to be $localarchlibdir" >&5
printf "%s\n" "defining localarchlibdir to be $localarchlibdir" >&6; }




- : ${localapiarchlibdir='${libexecdir}/octave/${api_version}/site/exec/${canonical_host_type}'}
+ : ${localapiarchlibdir='${libexecdir}/octave/${api_version}/site/exec/__MACPORTS_canonical_host_type__'}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localapiarchlibdir to be $localapiarchlibdir" >&5
$as_echo "defining localapiarchlibdir to be $localapiarchlibdir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defining localapiarchlibdir to be $localapiarchlibdir" >&5
printf "%s\n" "defining localapiarchlibdir to be $localapiarchlibdir" >&6; }




- : ${localverarchlibdir='${libexecdir}/octave/${version}/site/exec/${canonical_host_type}'}
+ : ${localverarchlibdir='${libexecdir}/octave/${version}/site/exec/__MACPORTS_canonical_host_type__'}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localverarchlibdir to be $localverarchlibdir" >&5
$as_echo "defining localverarchlibdir to be $localverarchlibdir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defining localverarchlibdir to be $localverarchlibdir" >&5
printf "%s\n" "defining localverarchlibdir to be $localverarchlibdir" >&6; }

@@ -8224,7 +8224,7 @@
@@ -8544,7 +8544,7 @@
## This path includes the Octave version and configuration name, so that
## configurations for multiple versions of Octave may be installed at once.

- : ${octfiledir='${libdir}/octave/${version}/oct/${canonical_host_type}'}
+ : ${octfiledir='${libdir}/octave/${version}/oct/__MACPORTS_canonical_host_type__'}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defining octfiledir to be $octfiledir" >&5
$as_echo "defining octfiledir to be $octfiledir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defining octfiledir to be $octfiledir" >&5
printf "%s\n" "defining octfiledir to be $octfiledir" >&6; }

@@ -8235,21 +8235,21 @@
@@ -8555,21 +8555,21 @@
## before consulting ${octfiledir}. This should be a colon-separated list of
## directories.

- : ${localoctfiledir='${libdir}/octave/site/oct/${canonical_host_type}'}
+ : ${localoctfiledir='${libdir}/octave/site/oct/__MACPORTS_canonical_host_type__'}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localoctfiledir to be $localoctfiledir" >&5
$as_echo "defining localoctfiledir to be $localoctfiledir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defining localoctfiledir to be $localoctfiledir" >&5
printf "%s\n" "defining localoctfiledir to be $localoctfiledir" >&6; }




- : ${localapioctfiledir='${libdir}/octave/site/oct/${api_version}/${canonical_host_type}'}
+ : ${localapioctfiledir='${libdir}/octave/site/oct/${api_version}/__MACPORTS_canonical_host_type__'}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localapioctfiledir to be $localapioctfiledir" >&5
$as_echo "defining localapioctfiledir to be $localapioctfiledir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defining localapioctfiledir to be $localapioctfiledir" >&5
printf "%s\n" "defining localapioctfiledir to be $localapioctfiledir" >&6; }




- : ${localveroctfiledir='${libdir}/octave/${version}/site/oct/${canonical_host_type}'}
+ : ${localveroctfiledir='${libdir}/octave/${version}/site/oct/__MACPORTS_canonical_host_type__'}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: defining localveroctfiledir to be $localveroctfiledir" >&5
$as_echo "defining localveroctfiledir to be $localveroctfiledir" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defining localveroctfiledir to be $localveroctfiledir" >&5
printf "%s\n" "defining localveroctfiledir to be $localveroctfiledir" >&6; }

12 comments on commit c5404c9

@barracuda156
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Schamschula Why was Qt4 removed? Was it actually broken? Configure script does not seem to require a specific version of Qt.

@Schamschula
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the 'news' for version 9.1.0!
The default is Qt6 (currently we are missing qscintilla-qt6). The news is Qt5 already on the way out: "Support for building with Qt5 is still available but might be removed in a future version of Octave." No mention of Qt4.

@barracuda156
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Schamschula I will try building it with Qt4, or if it does not work, it apparently has X11 support, which is not enabled in the port for some reason.

Will update on this. Portfile needs a couple of fixes anyway:
https://trac.macports.org/ticket/69574
https://trac.macports.org/ticket/69573

@barracuda156
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re Qt4, there was a claim here that is will be removed in v. 7: https://octave.org/NEWS-6.1.html
But then nothing is said later on if it was.

@kencu
Copy link
Contributor

@kencu kencu commented on c5404c9 Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re Qt4, there was a claim here that is will be removed in v. 7: octave.org/NEWS-6.1.html But then nothing is said later on if it was.

Upstream deprecated qt4 in octave 6.x.

At the beginning there were only smallish changes needed to keep qt4 alive, like this last set of fixes I did here:

c162006

but these became greater as the versions went by, and then qt4 supports was officially stripped out of octave in version 7.

gnu-octave/octave@12c2ea8

@barracuda156
Copy link
Contributor

@barracuda156 barracuda156 commented on c5404c9 Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kencu Thank you, Ken, this is the commit I was looking for. There were apparently other like gnu-octave/octave@4f7c682
So yeah, even that is probably feasible to restore, dropping the variant in the portfile was absolutely justified.
I may return to this if I have mood and time; for now, I will only deal with malloc issue and other minor stuff which does not require hours of rebasing something.

(I.e., I have built 9.1.0 on my PowerPC system with zero patches to the code, but portfile needs a couple of fix-ups.)

@kencu
Copy link
Contributor

@kencu kencu commented on c5404c9 Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if octave has a gtk3 version then that might be feasible to work on.

@barracuda156
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kencu That would do, since we know for the fact GTK3 works fine, but at least octave itself does not seem to have an option for it. Maybe there are third-party IDEs available.
octave seems to support some sort of X11 (--with-x), which is disabled in portfile now, but I have no idea what it does.

@kencu
Copy link
Contributor

@kencu kencu commented on c5404c9 Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the non-gui version of octave would be better than nothing on older systems...

@Schamschula
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the --with-x uses the FLTK backend. Here is the current note on that:

The FLTK backend is not maintained and its use is discouraged. The
recommended backend is qt. Enabling the fltk backend with graphics_toolkit fltk now emits a warning.

@barracuda156
Copy link
Contributor

@barracuda156 barracuda156 commented on c5404c9 Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ Schamschula Thank you for a clarification!

On a side note, could you say why the build system may be getting the path wrong when installing a package? Notice, it adds x here, and the cannot find needed files.

warning: creating build directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_octave_octave-io/octave-io/work/tmp-build
warning: called from
    build at line 49 column 5
    pkg at line 744 column 7

the DESCRIPTION file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_octave_octave-io/octave-io/work/tmp-build/x io/DESCRIPTION could not be read: No such file or directory

The correct path would be tmp-build/io/DESCRIPTION, but I cannot figure out what causes this error.

octave on its own now runs with malloc errors, so that issue sorted. But packages do not install due to this error with pkg build setting a wrong path.

@Schamschula
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above error is while building octave-io rather than octave itself.

The warning is expected. Creating the tmp-build directory is a required step.

I can't reproduce the DESCRIPTION file issue locally.

Please sign in to comment.