changeset 6186:4e45e976d7af

maint: Merge release to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 22 Apr 2022 20:15:29 +0200
parents ad50ef752299 (current diff) 8df7db467c66 (diff)
children 48acba316ae5
files dist-files.mk
diffstat 5 files changed, 101 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Fri Apr 22 10:27:33 2022 -0400
+++ b/dist-files.mk	Fri Apr 22 20:15:29 2022 +0200
@@ -520,6 +520,7 @@
   of-odepkg-2-fixes.patch \
   of-odepkg-3-deprecated.patch \
   of-odepkg.mk \
+  of-optim-1-nargin.patch \
   of-optim.mk \
   of-optiminterp.mk \
   of-quaternion-1-cross-fixes.patch \
--- a/installer-files/octave-firsttime.vbs	Fri Apr 22 10:27:33 2022 -0400
+++ b/installer-files/octave-firsttime.vbs	Fri Apr 22 20:15:29 2022 +0200
@@ -2,11 +2,18 @@
 
 Set wshShell = CreateObject( "WScript.Shell" )
 
+' If running with wscript.exe, "Exec" will flash a window for a split second.
+' Relaunch with cscript.exe which doesn't show that window.
+If InStr(1, WScript.FullName, "wscript.exe", vbTextCompare) > 0 Then
+  WScript.Quit wshShell.Run("cscript.exe """ & WScript.ScriptFullName & """", 0, True)
+End If
+
+
 ' get the directory that script resides in
 Set fso = CreateObject("Scripting.FileSystemObject")
 OctavePath = fso.GetParentFolderName(WScript.ScriptFullName)
 
-' ctavePath is now the root of the install folder, but for msys2,
+' OctavePath is now the root of the install folder, but for msys2,
 ' OctavePath should be OctavePath/mingw64 or OctavePath/ming32
 MSysType = "MSYS"
 MSysPath = OctavePath
@@ -55,9 +62,21 @@
   wshSystemEnv("QT_PLUGIN_PATH") = OctavePath & "\plugins"
 End If
 
-' pkg config pc path
+' pkgconfig .pc files path
 wshSystemEnv("PKG_CONFIG_PATH") = OctavePath & "\lib\pkgconfig"
 
+If wshShell.ExpandEnvironmentStrings("%OPENBLAS_NUM_THREADS%") = "%OPENBLAS_NUM_THREADS%" Then
+  ' set OPENBLAS_NUM_THREADS to number of physical processor cores.
+  Set wshExec = wshShell.Exec("wmic CPU Get NumberOfCores")
+  If Not wshExec.Stdout.atEndOfStream then
+    ' Check that first line contains "NumberOfCores".
+    If (InStr(1, wshExec.StdOut.ReadLine(), "NumberOfCores") = 1) And (Not wshExec.Stdout.atEndOfStream) then
+      ' The next line should contain the number of cores.
+      wshSystemEnv("OPENBLAS_NUM_THREADS") = wshExec.StdOut.ReadLine()
+    End If
+  End If
+End If
+
 ' set directory to users
 startpath = wshShell.ExpandEnvironmentStrings("%UserProfile%")
 wshShell.CurrentDirectory = startpath
--- a/installer-files/octave.bat	Fri Apr 22 10:27:33 2022 -0400
+++ b/installer-files/octave.bat	Fri Apr 22 20:15:29 2022 +0200
@@ -41,9 +41,27 @@
   set QT_PLUGIN_PATH=%OCT_HOME%\plugins
 )
 
-Rem pkgconfig .pc path
+Rem pkgconfig .pc files path
 set PKG_CONFIG_PATH=%OCT_HOME%\lib\pkgconfig
 
+IF NOT x%OPENBLAS_NUM_THREADS%==x GOTO openblas_num_threads_set
+
+Rem Set OPENBLAS_NUM_THREADS to number of physical processor cores.
+SETLOCAL ENABLEDELAYEDEXPANSION
+SET count=1
+FOR /F "tokens=* USEBACKQ" %%F IN (`wmic CPU Get NumberOfCores`) DO (
+  SET line!count!=%%F
+  SET /a count=!count!+1
+)
+Rem Check that first line contains "NumberOfCores".
+IF x%line1%==xNumberOfCores (
+  Rem The next line should contain the number of cores.
+  SET OPENBLAS_NUM_THREADS=%line2%
+)
+ENDLOCAL & SET OPENBLAS_NUM_THREADS=%OPENBLAS_NUM_THREADS%
+
+:openblas_num_threads_set
+
 Rem set home if not already set
 if "%HOME%"=="" set HOME=%USERPROFILE%
 if "%HOME%"=="" set HOME=%HOMEDRIVE%%HOMEPATH%
--- a/installer-files/octave.vbs	Fri Apr 22 10:27:33 2022 -0400
+++ b/installer-files/octave.vbs	Fri Apr 22 20:15:29 2022 +0200
@@ -2,12 +2,18 @@
 
 Set wshShell = CreateObject( "WScript.Shell" )
 
+' If running with wscript.exe, "Exec" will flash a window for a split second.
+' Relaunch with cscript.exe which doesn't show that window.
+If InStr(1, WScript.FullName, "wscript.exe", vbTextCompare) > 0 Then
+  WScript.Quit wshShell.Run("cscript.exe """ & WScript.ScriptFullName & """", 0, True)
+End If
+
 ' get the directory that script resides in
 Set fso = CreateObject("Scripting.FileSystemObject")
 OctavePath = fso.GetParentFolderName(WScript.ScriptFullName)
 
-' ctavePath is now the root of the install folder, but for msys2,
-' OctavePath should be OctavePath/mingw64 or OctavePath/ming32
+' OctavePath is now the root of the install folder, but for msys2,
+' OctavePath should be OctavePath/mingw64 or OctavePath/mingw32
 MSysType = "MSYS"
 MSysPath = OctavePath
 Set objFSO = CreateObject("Scripting.FileSystemObject")
@@ -15,7 +21,7 @@
   MSysPath = OctavePath & "\usr"
   MSysType = "MINGW64"
   OctavePath = OctavePath & "\mingw64" 
- ElseIf objFSO.FileExists(OctavePath & "\mingw32\bin\octave-cli.exe") Then
+ElseIf objFSO.FileExists(OctavePath & "\mingw32\bin\octave-cli.exe") Then
   MSysPath = OctavePath & "\usr"
   MSysType = "MINGW32"
   OctavePath = OctavePath & "\mingw32" 
@@ -56,9 +62,21 @@
   wshSystemEnv("QT_PLUGIN_PATH") = OctavePath & "\plugins"
 End If
 
-' pkg config pc path
+' pkgconfig .pc files path
 wshSystemEnv("PKG_CONFIG_PATH") = OctavePath & "\lib\pkgconfig"
 
+If wshShell.ExpandEnvironmentStrings("%OPENBLAS_NUM_THREADS%") = "%OPENBLAS_NUM_THREADS%" Then
+  ' Set OPENBLAS_NUM_THREADS to number of physical processor cores.
+  Set wshExec = wshShell.Exec("wmic CPU Get NumberOfCores")
+  If Not wshExec.Stdout.atEndOfStream then
+    ' Check that first line contains "NumberOfCores".
+    If (InStr(1, wshExec.StdOut.ReadLine(), "NumberOfCores") = 1) And (Not wshExec.Stdout.atEndOfStream) then
+      ' The next line should contain the number of cores.
+      wshSystemEnv("OPENBLAS_NUM_THREADS") = wshExec.StdOut.ReadLine()
+    End If
+  End If
+End If
+
 ' check args to see if told to run gui or command line
 ' and build other args to use
 GUI_MODE=1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/of-optim-1-nargin.patch	Fri Apr 22 20:15:29 2022 +0200
@@ -0,0 +1,38 @@
+# HG changeset patch
+# User Olaf Till <i7tiol@t-online.de>
+# Date 1650012368 -7200
+#      Fri Apr 15 10:46:08 2022 +0200
+# Node ID 197b5a882a41bc9945b6df95f0ef1fb2c7bfc82f
+# Parent  83eefe952baafe45135fac7f6ea23debde2f7267
+avoid 'too many arguments' in fmincon with user-supplied gradient
+
+* inst/fmincon.m: Define anonymous function f.dftp with (unused)
+'varargin'.
+
+diff -r 83eefe952baa -r 197b5a882a41 inst/fmincon.m
+--- a/inst/fmincon.m	Sun Apr 10 16:31:04 2022 +0200
++++ b/inst/fmincon.m	Fri Apr 15 10:46:08 2022 +0200
+@@ -217,7 +217,7 @@
+   o.df_equc_idx = false;
+ 
+   if (strcmp (o.GradObj, "on"))
+-    f.dfdp = @ (p) out_2_wrapper (f.objf, p);
++    f.dfdp = @ (p, varargin) out_2_wrapper (f.objf, p);
+     dfdp_specified = true;
+   else
+     f.dfdp = @ __dfdp__;
+
+Cross-building the docs doesn't work with the generic build rules in MXE Octave.
+De-activate building them (and use the existing docs from the tarball).
+diff -urN optim-1.6.2/src/Makefile.in.orig optim-1.6.2/src/Makefile.in
+--- optim-1.6.2/src/Makefile.in.orig	2022-04-10 16:31:04.000000000 +0200
++++ optim-1.6.2/src/Makefile.in	2022-04-22 19:48:02.532175109 +0200
+@@ -61,7 +61,7 @@
+ 
+ .INTERMEDIATE: MFDOCSTRINGS $(DSFILES)
+ 
+-all: doc $(OCTFILES)
++all: $(OCTFILES)
+ 
+ prebuild: doc html
+