push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,248 @@
{
lib,
stdenv,
fetchurl,
bzip2,
gfortran,
libX11,
libXmu,
libXt,
libjpeg,
libpng,
libtiff,
ncurses,
pango,
pcre2,
perl,
readline,
tcl,
texlive,
texliveSmall,
tk,
xz,
zlib,
less,
texinfo,
graphviz,
icu,
pkg-config,
bison,
which,
jdk,
blas,
lapack,
curl,
tzdata,
withRecommendedPackages ? true,
enableStrictBarrier ? false,
enableMemoryProfiling ? false,
# R as of writing does not support outputting both .so and .a files; it outputs:
# --enable-R-static-lib conflicts with --enable-R-shlib and will be ignored
static ? false,
testers,
}:
assert (!blas.isILP64) && (!lapack.isILP64);
stdenv.mkDerivation (finalAttrs: {
pname = "R";
version = "4.5.1";
src =
let
inherit (finalAttrs) pname version;
in
fetchurl {
url = "https://cran.r-project.org/src/base/R-${lib.versions.major version}/${pname}-${version}.tar.gz";
hash = "sha256-tCp5IUADhmRbEBBbkcaHKHh9tcTIPJ9sMKzc5jLhu3A=";
};
outputs = [
"out"
"tex"
];
nativeBuildInputs = [
bison
perl
pkg-config
tzdata
which
];
buildInputs = [
bzip2
gfortran
libX11
libXmu
libXt
libXt
libjpeg
libpng
libtiff
ncurses
pango
pcre2
readline
(texliveSmall.withPackages (
ps: with ps; [
inconsolata
helvetic
ps.texinfo
fancyvrb
cm-super
rsfs
]
))
xz
zlib
less
texinfo
graphviz
icu
which
blas
lapack
curl
tcl
tk
jdk
];
strictDeps = true;
patches = [
./no-usr-local-search-paths.patch
];
# Test of the examples for package 'tcltk' fails in Darwin sandbox. See:
# https://github.com/NixOS/nixpkgs/issues/146131
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace configure \
--replace "-install_name libRblas.dylib" "-install_name $out/lib/R/lib/libRblas.dylib" \
--replace "-install_name libRlapack.dylib" "-install_name $out/lib/R/lib/libRlapack.dylib" \
--replace "-install_name libR.dylib" "-install_name $out/lib/R/lib/libR.dylib"
substituteInPlace tests/Examples/Makefile.in \
--replace "test-Examples: test-Examples-Base" "test-Examples:" # do not test the examples
'';
dontDisableStatic = static;
preConfigure = ''
configureFlagsArray=(
--disable-lto
--with${lib.optionalString (!withRecommendedPackages) "out"}-recommended-packages
--with-blas="-L${blas}/lib -lblas"
--with-lapack="-L${lapack}/lib -llapack"
--with-readline
--with-tcltk --with-tcl-config="${tcl}/lib/tclConfig.sh" --with-tk-config="${tk}/lib/tkConfig.sh"
--with-cairo
--with-libpng
--with-jpeglib
--with-libtiff
--with-ICU
${lib.optionalString enableStrictBarrier "--enable-strict-barrier"}
${lib.optionalString enableMemoryProfiling "--enable-memory-profiling"}
${if static then "--enable-R-static-lib" else "--enable-R-shlib"}
AR=$(type -p ar)
AWK=$(type -p gawk)
CC=$(type -p cc)
CXX=$(type -p c++)
FC="${gfortran}/bin/gfortran" F77="${gfortran}/bin/gfortran"
JAVA_HOME="${jdk}"
RANLIB=$(type -p ranlib)
CURL_CONFIG="${lib.getExe' (lib.getDev curl) "curl-config"}"
r_cv_have_curl728=yes
R_SHELL="${stdenv.shell}"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
--disable-R-framework
--without-x
OBJC="clang"
CPPFLAGS="-isystem ${lib.getInclude stdenv.cc.libcxx}/include/c++/v1"
LDFLAGS="-L${lib.getLib stdenv.cc.libcxx}/lib"
''
+ ''
)
echo >>etc/Renviron.in "TCLLIBPATH=${tk}/lib"
echo >>etc/Renviron.in "TZDIR=${tzdata}/share/zoneinfo"
'';
installTargets = [
"install"
"install-info"
"install-pdf"
];
# move tex files to $tex for use with texlive.combine
# add link in $out since ${R_SHARE_DIR}/texmf is hardcoded in several places
postInstall = ''
mv -T "$out/lib/R/share/texmf" "$tex"
ln -s "$tex" "$out/lib/R/share/texmf"
'';
# The store path to "which" is baked into src/library/base/R/unix/system.unix.R,
# but Nix cannot detect it as a run-time dependency because the installed file
# is compiled and compressed, which hides the store path.
postFixup = ''
echo ${which} > $out/nix-support/undetected-runtime-dependencies
${lib.optionalString stdenv.hostPlatform.isLinux ''find $out -name "*.so" -exec patchelf {} --add-rpath $out/lib/R/lib \;''}
'';
doCheck = true;
preCheck = "export HOME=$TMPDIR; export TZ=CET; bin/Rscript -e 'sessionInfo()'";
enableParallelBuilding = true;
setupHook = ./setup-hook.sh;
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
# make tex output available to texlive.combine
passthru.pkgs = [ finalAttrs.finalPackage.tex ];
passthru.tlType = "run";
# dependencies (based on \RequirePackage in jss.cls, Rd.sty, Sweave.sty)
passthru.tlDeps = with texlive; [
amsfonts
amsmath
fancyvrb
graphics
hyperref
iftex
jknapltx
latex
lm
tools
upquote
url
];
meta = with lib; {
homepage = "http://www.r-project.org/";
description = "Free software environment for statistical computing and graphics";
license = licenses.gpl2Plus;
longDescription = ''
GNU R is a language and environment for statistical computing and
graphics that provides a wide variety of statistical (linear and
nonlinear modelling, classical statistical tests, time-series
analysis, classification, clustering, ...) and graphical
techniques, and is highly extensible. One of R's strengths is the
ease with which well-designed publication-quality plots can be
produced, including mathematical symbols and formulae where
needed. R is an integrated suite of software facilities for data
manipulation, calculation and graphical display. It includes an
effective data handling and storage facility, a suite of operators
for calculations on arrays, in particular matrices, a large,
coherent, integrated collection of intermediate tools for data
analysis, graphical facilities for data analysis and display
either on-screen or on hardcopy, and a well-developed, simple and
effective programming language which includes conditionals, loops,
user-defined recursive functions and input and output facilities.
'';
pkgConfigModules = [ "libR" ];
platforms = platforms.all;
maintainers = with maintainers; [ jbedo ];
teams = [ teams.sage ];
};
})

View File

@@ -0,0 +1,24 @@
diff -ubr R-3.0.1-orig/configure R-3.0.1/configure
--- R-3.0.1-orig/configure 2013-07-04 10:46:42.336133947 +0200
+++ R-3.0.1/configure 2013-07-04 10:46:17.181919960 +0200
@@ -3800,13 +3800,13 @@
: ${LIBnn=$libnn}
## We provide these defaults so that headers and libraries in
## '/usr/local' are found (by the native tools, mostly).
-if test -f "/sw/etc/fink.conf"; then
- : ${CPPFLAGS="-I/sw/include -I/usr/local/include"}
- : ${LDFLAGS="-L/sw/lib -L/usr/local/lib"}
-else
- : ${CPPFLAGS="-I/usr/local/include"}
- : ${LDFLAGS="-L/usr/local/${LIBnn}"}
-fi
+# if test -f "/sw/etc/fink.conf"; then
+# : ${CPPFLAGS="-I/sw/include -I/usr/local/include"}
+# : ${LDFLAGS="-L/sw/lib -L/usr/local/lib"}
+# else
+# : ${CPPFLAGS="-I/usr/local/include"}
+# : ${LDFLAGS="-L/usr/local/${LIBnn}"}
+# fi
## take care not to override the command-line setting
if test "${libdir}" = '${exec_prefix}/lib'; then

View File

@@ -0,0 +1,7 @@
addRLibPath () {
if [[ -d "$1/library" ]]; then
addToSearchPath R_LIBS_SITE "$1/library"
fi
}
addEnvHooks "$targetOffset" addRLibPath

View File

@@ -0,0 +1,47 @@
diff --git a/Makefile b/Makefile
index c823f66e..65b90c5e 100644
--- a/Makefile
+++ b/Makefile
@@ -32,9 +32,9 @@ SRC_DIRS := $(shell find * -type d -exec bash -c "find {} -maxdepth 1 \
LIBRARY_NAME := $(PROJECT)
LIB_BUILD_DIR := $(BUILD_DIR)/lib
STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a
-DYNAMIC_VERSION_MAJOR := 1
-DYNAMIC_VERSION_MINOR := 0
-DYNAMIC_VERSION_REVISION := 0
+DYNAMIC_VERSION_MAJOR := 1
+DYNAMIC_VERSION_MINOR := 0
+DYNAMIC_VERSION_REVISION := 0
DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so
#DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR)
DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION)
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index c48255c8..cf4c580e 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -105,7 +105,6 @@ if(USE_OPENCV)
endif()
# ---[ BLAS
-if(NOT APPLE)
set(BLAS "Atlas" CACHE STRING "Selected BLAS library")
set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL")
@@ -123,17 +122,6 @@ if(NOT APPLE)
list(APPEND Caffe_LINKER_LIBS PUBLIC ${MKL_LIBRARIES})
list(APPEND Caffe_DEFINITIONS PUBLIC -DUSE_MKL)
endif()
-elseif(APPLE)
- find_package(vecLib REQUIRED)
- list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${vecLib_INCLUDE_DIR})
- list(APPEND Caffe_LINKER_LIBS PUBLIC ${vecLib_LINKER_LIBS})
-
- if(VECLIB_FOUND)
- if(NOT vecLib_INCLUDE_DIR MATCHES "^/System/Library/Frameworks/vecLib.framework.*")
- list(APPEND Caffe_DEFINITIONS PUBLIC -DUSE_ACCELERATE)
- endif()
- endif()
-endif()
# ---[ Python
if(BUILD_python)

View File

@@ -0,0 +1,182 @@
{
stdenv,
lib,
fetchFromGitHub,
fetchurl,
fetchpatch,
cmake,
boost,
gflags,
glog,
hdf5-cpp,
opencv4,
protobuf,
doxygen,
blas,
lmdbSupport ? true,
lmdb,
leveldbSupport ? true,
leveldb,
snappy,
pythonSupport ? false,
python ? null,
numpy ? null,
replaceVars,
}:
let
toggle = bool: if bool then "ON" else "OFF";
test_model_weights = fetchurl {
url = "http://dl.caffe.berkeleyvision.org/bvlc_reference_caffenet.caffemodel";
sha256 = "472d4a06035497b180636d8a82667129960371375bd10fcb6df5c6c7631f25e0";
};
in
stdenv.mkDerivation rec {
pname = "caffe";
version = "1.0";
src = fetchFromGitHub {
owner = "BVLC";
repo = "caffe";
rev = version;
sha256 = "104jp3cm823i3cdph7hgsnj6l77ygbwsy35mdmzhmsi4jxprd9j3";
};
nativeBuildInputs = [
cmake
doxygen
];
cmakeFlags =
# It's important that caffe is passed the major and minor version only because that's what
# boost_python expects
[
(if pythonSupport then "-Dpython_version=${python.pythonVersion}" else "-DBUILD_python=OFF")
"-DBLAS=open"
"-DCPU_ONLY=ON"
]
++ [ "-DUSE_LEVELDB=${toggle leveldbSupport}" ]
++ [ "-DUSE_LMDB=${toggle lmdbSupport}" ];
buildInputs = [
boost
gflags
glog
protobuf
hdf5-cpp
opencv4
blas
]
++ lib.optional lmdbSupport lmdb
++ lib.optionals leveldbSupport [
leveldb
snappy
]
++ lib.optionals pythonSupport [
python
numpy
];
propagatedBuildInputs = lib.optionals pythonSupport (
# requirements.txt
let
pp = python.pkgs;
in
(
[
pp.numpy
pp.scipy
pp.scikit-image
pp.h5py
pp.matplotlib
pp.ipython
pp.networkx
pp.pandas
pp.python-dateutil
pp.protobuf
pp.gflags
pp.pyyaml
pp.pillow
pp.six
]
++ lib.optional leveldbSupport pp.leveldb
)
);
outputs = [
"bin"
"out"
];
propagatedBuildOutputs = [ ]; # otherwise propagates out -> bin cycle
patches = [
./darwin.patch
./glog-cmake.patch
./random-shuffle.patch
(fetchpatch {
name = "support-opencv4";
url = "https://github.com/BVLC/caffe/pull/6638/commits/0a04cc2ccd37ba36843c18fea2d5cbae6e7dd2b5.patch";
hash = "sha256-ZegTvp0tTHlopQv+UzHDigs6XLkP2VfqLCWXl6aKJSI=";
})
]
++ lib.optional pythonSupport (
replaceVars ./python.patch {
inherit (python.sourceVersion) major minor; # Should be changed in case of PyPy
}
);
postPatch = ''
substituteInPlace src/caffe/util/io.cpp --replace \
'SetTotalBytesLimit(kProtoReadBytesLimit, 536870912)' \
'SetTotalBytesLimit(kProtoReadBytesLimit)'
'';
preConfigure = lib.optionalString pythonSupport ''
# We need this when building with Python bindings
export BOOST_LIBRARYDIR="${boost.out}/lib";
'';
postInstall = ''
# Internal static library.
rm $out/lib/libproto.a
# Install models
cp -a ../models $out/share/Caffe/models
moveToOutput "bin" "$bin"
''
+ lib.optionalString pythonSupport ''
mkdir -p $out/${python.sitePackages}
mv $out/python/caffe $out/${python.sitePackages}
rm -rf $out/python
'';
doInstallCheck = false; # build takes more than 30 min otherwise
installCheckPhase = ''
model=bvlc_reference_caffenet
m_path="$out/share/Caffe/models/$model"
$bin/bin/caffe test \
-model "$m_path/deploy.prototxt" \
-solver "$m_path/solver.prototxt" \
-weights "${test_model_weights}"
'';
meta = with lib; {
description = "Deep learning framework";
longDescription = ''
Caffe is a deep learning framework made with expression, speed, and
modularity in mind. It is developed by the Berkeley Vision and Learning
Center (BVLC) and by community contributors.
'';
homepage = "http://caffe.berkeleyvision.org/";
maintainers = [ ];
broken =
(pythonSupport && (python.isPy310))
|| !(leveldbSupport -> (leveldb != null && snappy != null))
|| !(pythonSupport -> (python != null && numpy != null));
license = licenses.bsd2;
platforms = platforms.linux ++ platforms.darwin;
};
}

View File

@@ -0,0 +1,97 @@
From 38b81bb53304d7a3f6aed36f7b4e77b6efa78338 Mon Sep 17 00:00:00 2001
From: uku <hi@uku.moe>
Date: Wed, 14 May 2025 16:55:15 +0200
Subject: [PATCH] fix linking against glog 0.7.x
---
cmake/Dependencies.cmake | 2 +-
cmake/External/glog.cmake | 4 +--
cmake/Modules/FindGlog.cmake | 48 ------------------------------------
3 files changed, 3 insertions(+), 51 deletions(-)
delete mode 100644 cmake/Modules/FindGlog.cmake
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 4a5bac47..88aa123f 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -32,7 +32,7 @@ endif()
# ---[ Google-glog
include("cmake/External/glog.cmake")
list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${GLOG_INCLUDE_DIRS})
-list(APPEND Caffe_LINKER_LIBS PUBLIC ${GLOG_LIBRARIES})
+list(APPEND Caffe_LINKER_LIBS PUBLIC glog::glog)
# ---[ Google-gflags
include("cmake/External/gflags.cmake")
diff --git a/cmake/External/glog.cmake b/cmake/External/glog.cmake
index f9d0549c..43414544 100644
--- a/cmake/External/glog.cmake
+++ b/cmake/External/glog.cmake
@@ -5,8 +5,8 @@ if (NOT __GLOG_INCLUDED)
set(__GLOG_INCLUDED TRUE)
# try the system-wide glog first
- find_package(Glog)
- if (GLOG_FOUND)
+ find_package(glog REQUIRED)
+ if (glog_FOUND)
set(GLOG_EXTERNAL FALSE)
else()
# fetch and build glog from github
diff --git a/cmake/Modules/FindGlog.cmake b/cmake/Modules/FindGlog.cmake
deleted file mode 100644
index 99abbe47..00000000
--- a/cmake/Modules/FindGlog.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-# - Try to find Glog
-#
-# The following variables are optionally searched for defaults
-# GLOG_ROOT_DIR: Base directory where all GLOG components are found
-#
-# The following are set after configuration is done:
-# GLOG_FOUND
-# GLOG_INCLUDE_DIRS
-# GLOG_LIBRARIES
-# GLOG_LIBRARYRARY_DIRS
-
-include(FindPackageHandleStandardArgs)
-
-set(GLOG_ROOT_DIR "" CACHE PATH "Folder contains Google glog")
-
-if(WIN32)
- find_path(GLOG_INCLUDE_DIR glog/logging.h
- PATHS ${GLOG_ROOT_DIR}/src/windows)
-else()
- find_path(GLOG_INCLUDE_DIR glog/logging.h
- PATHS ${GLOG_ROOT_DIR})
-endif()
-
-if(MSVC)
- find_library(GLOG_LIBRARY_RELEASE libglog_static
- PATHS ${GLOG_ROOT_DIR}
- PATH_SUFFIXES Release)
-
- find_library(GLOG_LIBRARY_DEBUG libglog_static
- PATHS ${GLOG_ROOT_DIR}
- PATH_SUFFIXES Debug)
-
- set(GLOG_LIBRARY optimized ${GLOG_LIBRARY_RELEASE} debug ${GLOG_LIBRARY_DEBUG})
-else()
- find_library(GLOG_LIBRARY glog
- PATHS ${GLOG_ROOT_DIR}
- PATH_SUFFIXES lib lib64)
-endif()
-
-find_package_handle_standard_args(Glog DEFAULT_MSG GLOG_INCLUDE_DIR GLOG_LIBRARY)
-
-if(GLOG_FOUND)
- set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
- set(GLOG_LIBRARIES ${GLOG_LIBRARY})
- message(STATUS "Found glog (include: ${GLOG_INCLUDE_DIR}, library: ${GLOG_LIBRARY})")
- mark_as_advanced(GLOG_ROOT_DIR GLOG_LIBRARY_RELEASE GLOG_LIBRARY_DEBUG
- GLOG_LIBRARY GLOG_INCLUDE_DIR)
-endif()
--
2.49.0

View File

@@ -0,0 +1,70 @@
commit b14ca23651d390fcae4a929dedc7c33a83453a66
Author: Frederik Rietdijk <fridh@fridh.nl>
Date: Sun Feb 17 08:41:27 2019 +0100
Find boost_pythonXX
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08f56a33..0a04592a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,10 +99,10 @@ add_subdirectory(docs)
add_custom_target(lint COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lint.cmake)
# ---[ pytest target
-if(BUILD_python)
- add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
- add_dependencies(pytest pycaffe)
-endif()
+# if(BUILD_python)
+# add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
+# add_dependencies(pytest pycaffe)
+# endif()
# ---[ uninstall target
configure_file(
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 4a5bac47..be026d43 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -141,37 +141,14 @@ if(BUILD_python)
# use python3
find_package(PythonInterp 3.0)
find_package(PythonLibs 3.0)
- find_package(NumPy 1.7.1)
- # Find the matching boost python implementation
- set(version ${PYTHONLIBS_VERSION_STRING})
-
- STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
- find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
- set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
-
- while(NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
- STRING( REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version} )
-
- STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
- find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
- set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
-
- STRING( REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version} )
- if("${has_more_version}" STREQUAL "")
- break()
- endif()
- endwhile()
- if(NOT Boost_PYTHON_FOUND)
- find_package(Boost 1.46 COMPONENTS python)
- endif()
else()
# disable Python 3 search
find_package(PythonInterp 2.7)
find_package(PythonLibs 2.7)
- find_package(NumPy 1.7.1)
- find_package(Boost 1.46 COMPONENTS python)
endif()
- if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON_FOUND)
+ find_package(NumPy 1.7.1)
+ find_package(Boost 1.46 REQUIRED COMPONENTS python@major@@minor@)
+ if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON@major@@minor@_FOUND)
set(HAVE_PYTHON TRUE)
if(BUILD_python_layer)
list(APPEND Caffe_DEFINITIONS PRIVATE -DWITH_PYTHON_LAYER)

View File

@@ -0,0 +1,67 @@
From 11e585e52ab92bb9d7a995c5002cb55fbff687b2 Mon Sep 17 00:00:00 2001
From: uku <hi@uku.moe>
Date: Thu, 15 May 2025 11:10:50 +0200
Subject: [PATCH] fix: remove usages of random_shuffle
---
src/caffe/layers/hdf5_data_layer.cpp | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/caffe/layers/hdf5_data_layer.cpp b/src/caffe/layers/hdf5_data_layer.cpp
index 00716a92..01213691 100644
--- a/src/caffe/layers/hdf5_data_layer.cpp
+++ b/src/caffe/layers/hdf5_data_layer.cpp
@@ -61,7 +61,9 @@ void HDF5DataLayer<Dtype>::LoadHDF5FileData(const char* filename) {
// Shuffle if needed.
if (this->layer_param_.hdf5_data_param().shuffle()) {
- std::random_shuffle(data_permutation_.begin(), data_permutation_.end());
+ std::random_device rand_device;
+ std::default_random_engine rand_engine(rand_device());
+ std::shuffle(data_permutation_.begin(), data_permutation_.end(), rand_engine);
DLOG(INFO) << "Successfully loaded " << hdf_blobs_[0]->shape(0)
<< " rows (shuffled)";
} else {
@@ -104,7 +106,9 @@ void HDF5DataLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
// Shuffle if needed.
if (this->layer_param_.hdf5_data_param().shuffle()) {
- std::random_shuffle(file_permutation_.begin(), file_permutation_.end());
+ std::random_device rand_device;
+ std::default_random_engine rand_engine(rand_device());
+ std::shuffle(file_permutation_.begin(), file_permutation_.end(), rand_engine);
}
// Load the first HDF5 file and initialize the line counter.
@@ -137,14 +141,17 @@ bool HDF5DataLayer<Dtype>::Skip() {
template<typename Dtype>
void HDF5DataLayer<Dtype>::Next() {
+ std::random_device rand_device;
+ std::default_random_engine rand_engine(rand_device());
if (++current_row_ == hdf_blobs_[0]->shape(0)) {
if (num_files_ > 1) {
++current_file_;
if (current_file_ == num_files_) {
current_file_ = 0;
if (this->layer_param_.hdf5_data_param().shuffle()) {
- std::random_shuffle(file_permutation_.begin(),
- file_permutation_.end());
+ std::shuffle(file_permutation_.begin(),
+ file_permutation_.end(),
+ rand_engine);
}
DLOG(INFO) << "Looping around to first file.";
}
@@ -153,7 +160,7 @@ void HDF5DataLayer<Dtype>::Next() {
}
current_row_ = 0;
if (this->layer_param_.hdf5_data_param().shuffle())
- std::random_shuffle(data_permutation_.begin(), data_permutation_.end());
+ std::shuffle(data_permutation_.begin(), data_permutation_.end(), rand_engine);
}
offset_++;
}
--
2.49.0

View File

@@ -0,0 +1,51 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
pkg-config,
qt6,
libarchive,
libpng,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "CEmu";
version = "2.0";
src = fetchFromGitHub {
owner = "CE-Programming";
repo = "CEmu";
rev = "v${finalAttrs.version}";
hash = "sha256-fohsIJrvPDMmYHoPbmYQlKLMnj/B3XEBaerZYuqxvd8=";
fetchSubmodules = true;
};
sourceRoot = "${finalAttrs.src.name}/gui/qt/";
patches = [
# This is resolved upstream, but I can't apply the patch because the
# sourceRoot isn't set to the base of the Git repo.
./resolve-ambiguous-constexpr.patch
];
nativeBuildInputs = [
cmake
qt6.wrapQtAppsHook
pkg-config
];
buildInputs = [
qt6.qtbase
libarchive
libpng
];
meta = with lib; {
description = "Third-party TI-84 Plus CE / TI-83 Premium CE emulator, focused on developer features";
mainProgram = "CEmu";
homepage = "https://ce-programming.github.io/CEmu";
license = licenses.gpl3Plus;
maintainers = [ ];
platforms = lib.platforms.unix;
};
})

View File

@@ -0,0 +1,13 @@
diff --git a/mainwindow.cpp b/mainwindow.cpp
index f03a743e..70c29a45 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -970,7 +970,7 @@ void MainWindow::showEvent(QShowEvent *e) {
DockWidget *MainWindow::redistributeFindDock(const QPoint &pos) {
QWidget *child = childAt(pos);
if (QTabBar *tabBar = findSelfOrParent<QTabBar *>(child)) {
- child = childAt({pos.x(), tabBar->mapTo(this, QPoint{}).y() - 1});
+ child = childAt(QPoint({pos.x(), tabBar->mapTo(this, QPoint{}).y() - 1}));
}
return findSelfOrParent<DockWidget *>(child);
}

View File

@@ -0,0 +1,183 @@
{
lib,
stdenv,
autoPatchelfHook,
makeDesktopItem,
copyDesktopItems,
makeWrapper,
alsa-lib,
glib,
glib-networking,
gsettings-desktop-schemas,
gtk3,
libsecret,
openjdk,
sqlite,
unixODBC,
gtk2,
xorg,
glibcLocales,
releasePath ? null,
}:
# To use this package, you need to download your own cplex installer from IBM
# and override the releasePath attribute to point to the location of the file.
#
# Note: cplex creates an individual build for each license which screws
# somewhat with the use of functions like requireFile as the hash will be
# different for every user.
stdenv.mkDerivation rec {
pname = "cplex";
version = "22.11";
src =
if releasePath == null then
throw ''
This nix expression requires that the cplex installer is already
downloaded to your machine. Get it from IBM:
https://www.ibm.com/support/pages/downloading-ibm-ilog-cplex-optimization-studio-2211
Set `cplex.releasePath = /path/to/download;` in your
~/.config/nixpkgs/config.nix for `nix-*` commands, or
`config.cplex.releasePath = /path/to/download;` in your
`configuration.nix` for NixOS.
''
else
releasePath;
nativeBuildInputs = [
autoPatchelfHook
copyDesktopItems
makeWrapper
openjdk
];
buildInputs = [
alsa-lib
gsettings-desktop-schemas
gtk2
sqlite
unixODBC
xorg.libXtst
glibcLocales
];
unpackPhase = "cp $src $name";
postPatch = ''
sed -i -e 's|/usr/bin/tr"|tr" |' $name
'';
buildPhase = ''
runHook preBuild
export JAVA_TOOL_OPTIONS=-Djdk.util.zip.disableZip64ExtraFieldValidation=true
sh $name LAX_VM "$(command -v java)" -i silent -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR=$out
runHook postBuild
'';
installPhase =
let
libraryPath = lib.makeLibraryPath [
stdenv.cc.cc
glib
gtk2
gtk3
libsecret
xorg.libXtst
];
in
''
runHook preInstall
mkdir -p $out/bin
for pgm in \
$out/opl/bin/x86-64_linux/oplrun \
$out/opl/bin/x86-64_linux/oplrunjava \
$out/opl/oplide/oplide \
$out/cplex/bin/x86-64_linux/cplex \
$out/cpoptimizer/bin/x86-64_linux/cpoptimizer
do
makeWrapperArgs=(
--set-default LOCALE_ARCHIVE ${glibcLocales}/lib/locale/locale-archive
)
if [[ "$pgm" = "$out/opl/oplide/oplide" ]]; then
makeWrapperArgs+=(
--prefix LD_LIBRARY_PATH : ${libraryPath}
--prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules"
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
)
fi
makeWrapper "$pgm" "$out/bin/$(basename "$pgm")" "''${makeWrapperArgs[@]}"
done
mkdir -p $out/share/pixmaps
ln -s $out/opl/oplide/icon.xpm $out/share/pixmaps/oplide.xpm
mkdir -p $out/share/doc
mv $out/doc $out/share/doc/$name
mkdir -p $out/share/licenses
mv $out/license $out/share/licenses/$name
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "oplide";
desktopName = "IBM ILOG CPLEX Optimization Studio";
genericName = "Optimization Software";
icon = "oplide";
exec = "oplide";
categories = [
"Development"
"IDE"
"Math"
"Science"
];
})
];
fixupPhase = ''
runHook preFixup
rm -r $out/Uninstall
bins=(
$out/bin/*
$out/cplex/bin/x86-64_linux/cplex
$out/cplex/bin/x86-64_linux/cplexamp
$out/cpoptimizer/bin/x86-64_linux/cpoptimizer
$out/opl/bin/x86-64_linux/oplrun
$out/opl/bin/x86-64_linux/oplrunjava
$out/opl/oplide/jre/bin/*
$out/opl/oplide/oplide
)
find $out -type d -exec chmod 755 {} \;
find $out -type f -exec chmod 644 {} \;
chmod +111 "''${bins[@]}"
runHook postFixup
'';
passthru = {
libArch = "x86-64_linux";
libSuffix = "${version}0";
};
meta = with lib; {
description = "Optimization solver for mathematical programming";
homepage = "https://www.ibm.com/be-en/marketplace/ibm-ilog-cplex";
mainProgram = "cplex";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ bfortz ];
};
}

View File

@@ -0,0 +1,76 @@
{
lib,
stdenv,
fetchFromGitHub,
fftw,
libjpeg,
log4cpp,
openjpeg,
libpng12,
poppler,
qtbase,
qt5,
qmake,
wrapQtAppsHook,
}:
stdenv.mkDerivation rec {
pname = "engauge-digitizer";
version = "12.2.2";
src = fetchFromGitHub {
owner = "markummitchell";
repo = "engauge-digitizer";
rev = "v${version}";
sha256 = "sha256-Wj9o3wWbtHsEi6LFH4xDpwVR9BwcWc472jJ/QFDQZvY=";
};
nativeBuildInputs = [
qmake
wrapQtAppsHook
];
buildInputs = [
qtbase
qt5.qttools
poppler
libpng12
openjpeg
openjpeg.dev
log4cpp
libjpeg
fftw
];
qmakeFlags = [
"CONFIG+=jpeg2000"
"CONFIG+=pdf"
"CONFIG+=log4cpp_null"
];
POPPLER_INCLUDE = "${poppler.dev}/include/poppler/qt5";
POPPLER_LIB = "${poppler}/lib";
OPENJPEG_INCLUDE = "${openjpeg.dev}/include/${openjpeg.pname}-${lib.versions.majorMinor openjpeg.version}";
OPENJPEG_LIB = "${openjpeg}/lib";
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp bin/engauge $out/bin/
runHook postInstall
'';
meta = with lib; {
description = "Engauge Digitizer is a tool for recovering graph data from an image file";
mainProgram = "engauge";
homepage = "https://markummitchell.github.io/engauge-digitizer";
license = with licenses; [ gpl2Only ];
platforms = platforms.linux;
maintainers = [ maintainers.sheepforce ];
};
}

View File

@@ -0,0 +1,79 @@
{
lib,
stdenv,
fetchurl,
ocamlPackages,
makeWrapper,
libGLU,
libGL,
libglut,
mpfr,
gmp,
pkgsHostTarget,
}:
let
inherit (pkgsHostTarget.targetPackages.stdenv) cc;
in
stdenv.mkDerivation rec {
pname = "glsurf";
version = "3.3.1";
src = fetchurl {
url = "https://raffalli.eu/~christophe/glsurf/glsurf-${version}.tar.gz";
sha256 = "0w8xxfnw2snflz8wdr2ca9f5g91w5vbyp1hwlx1v7vg83d4bwqs7";
};
nativeBuildInputs = [
makeWrapper
]
++ (with ocamlPackages; [
ocaml
findlib
]);
buildInputs = [
libglut
libGL
libGLU
mpfr
gmp
]
++ (with ocamlPackages; [
camlp4
lablgl
camlimages
num
]);
postPatch = ''
for f in callbacks*/Makefile; do
substituteInPlace "$f" --replace-warn "+camlp4" \
"${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4"
done
# Fatal error: exception Sys_error("Mutex.unlock: Operation not permitted")
sed -i "/gl_started/d" src/draw.ml* src/main.ml
# Compatibility with camlimages 5.0.5
substituteInPlace src/Makefile --replace-warn camlimages.all_formats camlimages.core
'';
installPhase = ''
mkdir -p $out/bin $out/share/doc/glsurf
cp ./src/glsurf.opt $out/bin/glsurf
cp ./doc/doc.pdf $out/share/doc/glsurf
cp -r ./examples $out/share/doc/glsurf
wrapProgram "$out/bin/glsurf" --set CC "${cc}/bin/${cc.targetPrefix}cc"
'';
meta = {
homepage = "https://raffalli.eu/~christophe/glsurf/";
description = "Program to draw implicit surfaces and curves";
mainProgram = "glsurf";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,128 @@
{
lib,
stdenv,
fetchpatch,
fetchurl,
cmake,
extra-cmake-modules,
shared-mime-info,
wrapQtAppsHook,
qtbase,
karchive,
kcompletion,
kconfig,
kcoreaddons,
kcrash,
kdoctools,
ki18n,
kiconthemes,
kio,
knewstuff,
kparts,
ktextwidgets,
kxmlgui,
syntax-highlighting,
gsl,
poppler,
fftw,
hdf5,
netcdf,
cfitsio,
libcerf,
# cantor,
zlib,
lz4,
readstat,
matio,
qtserialport,
discount,
}:
stdenv.mkDerivation rec {
pname = "labplot";
version = "2.10.1";
src = fetchurl {
url = "mirror://kde/stable/labplot/labplot-${version}.tar.xz";
sha256 = "sha256-K24YFRfPtuDf/3uJXz6yDHzjWeZzLThUXgdXya6i2u8=";
};
cmakeFlags = [
# Disable Vector BLF since it depends on DBC parser which fails to be detected
"-DENABLE_VECTOR_BLF=OFF"
];
patches = [
(fetchpatch {
name = "matio-fix-compilation-for-latest-version-1.5.27.patch";
url = "https://github.com/KDE/labplot/commit/d6142308ffa492d9f7cea00fad3b4cd1babfd00c.patch";
hash = "sha256-qD5jj6GxBKbQezKJb1Z8HnwFO84WJBGQDawS/6o/wHE=";
})
];
nativeBuildInputs = [
cmake
extra-cmake-modules
shared-mime-info
wrapQtAppsHook
];
buildInputs = [
qtbase
karchive
kcompletion
kconfig
kcoreaddons
kcrash
kdoctools
ki18n
kiconthemes
kio
knewstuff
kparts
ktextwidgets
kxmlgui
syntax-highlighting
gsl
poppler
fftw
hdf5
netcdf
cfitsio
libcerf
# cantor
zlib
lz4
readstat
matio
qtserialport
discount
];
meta = with lib; {
description = "Free, open source and cross-platform data visualization and analysis software accessible to everyone";
homepage = "https://labplot.kde.org";
license = with licenses; [
asl20
bsd3
cc-by-30
cc0
gpl2Only
gpl2Plus
gpl3Only
gpl3Plus
lgpl3Plus
mit
];
maintainers = with maintainers; [ hqurve ];
mainProgram = "labplot2";
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,53 @@
diff --git a/lp_solve/ccc b/lp_solve/ccc
index bd5a938..7fe0427 100644
--- a/lp_solve/ccc
+++ b/lp_solve/ccc
@@ -1,6 +1,6 @@
:
src='../lp_MDO.c ../shared/commonlib.c ../colamd/colamd.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c lp_solve.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
-c=cc
+c=$CC
MYTMP=`mktemp -d "${TMPDIR:-/tmp}"/lp_solve_XXXXXX`
@@ -10,7 +10,7 @@ echo '#include <stdlib.h>'>>"$MYTMP"/platform.c
echo '#include <stdio.h>'>>"$MYTMP"/platform.c
echo 'main(){printf("ux%d", (int) (sizeof(void *)*8));}'>>"$MYTMP"/platform.c
$c "$MYTMP"/platform.c -o "$MYTMP"/platform
-PLATFORM=`"$MYTMP"/platform`
+PLATFORM=`@emulator@ "$MYTMP"/platform`
rm "$MYTMP"/platform "$MYTMP"/platform.c >/dev/null 2>&1
mkdir bin bin/$PLATFORM >/dev/null 2>&1
diff --git a/lpsolve55/ccc b/lpsolve55/ccc
index 999f5f6..ff69b17 100644
--- a/lpsolve55/ccc
+++ b/lpsolve55/ccc
@@ -1,6 +1,6 @@
:
src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../colamd/colamd.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
-c=cc
+c=$CC
MYTMP=`mktemp -d "${TMPDIR:-/tmp}"/lp_solve_XXXXXX`
@@ -10,7 +10,7 @@ echo '#include <stdlib.h>'>>"$MYTMP"/platform.c
echo '#include <stdio.h>'>>"$MYTMP"/platform.c
echo 'main(){printf("ux%d", (int) (sizeof(void *)*8));}'>>"$MYTMP"/platform.c
$c "$MYTMP"/platform.c -o "$MYTMP"/platform
-PLATFORM=`"$MYTMP"/platform`
+PLATFORM=`@emulator@ "$MYTMP"/platform`
rm "$MYTMP"/platform "$MYTMP"/platform.c >/dev/null 2>&1
mkdir bin bin/$PLATFORM >/dev/null 2>&1
@@ -42,8 +42,8 @@ fi
opts='-O3'
$c -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def $NOISNAN -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
-ar rv bin/$PLATFORM/liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
-ranlib bin/$PLATFORM/liblpsolve55.a
+$AR rv bin/$PLATFORM/liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
+$RANLIB bin/$PLATFORM/liblpsolve55.a
if [ "$so" != "" ]
then

View File

@@ -0,0 +1,83 @@
{
lib,
stdenv,
fetchurl,
cctools,
fixDarwinDylibNames,
autoSignDarwinBinariesHook,
replaceVars,
buildPackages,
binutils,
}:
stdenv.mkDerivation rec {
pname = "lp_solve";
version = "5.5.2.11";
src = fetchurl {
url = "mirror://sourceforge/project/lpsolve/lpsolve/${version}/lp_solve_${version}_source.tar.gz";
sha256 = "sha256-bUq/9cxqqpM66ObBeiJt8PwLZxxDj2lxXUHQn+gfkC8=";
};
nativeBuildInputs = [
binutils
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
cctools
fixDarwinDylibNames
]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
autoSignDarwinBinariesHook
];
env = {
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-int";
}
// lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) {
NIX_LDFLAGS = "-headerpad_max_install_names";
};
dontConfigure = true;
patches = [
(replaceVars ./0001-fix-cross-compilation.patch {
emulator = "${stdenv.hostPlatform.emulator buildPackages}";
})
];
buildPhase =
let
ccc = if stdenv.hostPlatform.isDarwin then "ccc.osx" else "ccc";
in
''
runHook preBuild
(cd lpsolve55 && bash -x -e ${ccc})
(cd lp_solve && bash -x -e ${ccc})
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -d -m755 $out/bin $out/lib $out/include/lpsolve
install -m755 lp_solve/bin/*/lp_solve -t $out/bin
install -m644 lpsolve55/bin/*/liblpsolve* -t $out/lib
install -m644 lp_*.h -t $out/include/lpsolve
rm $out/lib/liblpsolve*.a
rm $out/include/lpsolve/lp_solveDLL.h # A Windows header
runHook postInstall
'';
meta = with lib; {
description = "Mixed Integer Linear Programming (MILP) solver";
mainProgram = "lp_solve";
homepage = "https://lpsolve.sourceforge.net";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ smironov ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,86 @@
Based on upstream https://sourceforge.net/p/maxima/code/ci/51704ccb090f6f971b641e4e0b7c1c22c4828bf7/
adjusted to apply to 5.47.0
diff --git a/src/gnuplot_def.lisp b/src/gnuplot_def.lisp
index 80c174bd5..6fdc8da6d 100644
--- a/src/gnuplot_def.lisp
+++ b/src/gnuplot_def.lisp
@@ -286,7 +286,7 @@
(format nil "set term postscript eps color solid lw 2 size 16.4 cm, 12.3 cm font \",24\" ~a" gstrings)))
(if (getf plot-options :gnuplot_out_file)
(setq out-file (getf plot-options :gnuplot_out_file))
- (setq out-file "maxplot.ps")))
+ (setq out-file (format nil "~a.ps" (random-name 16)))))
((eq (getf plot-options :gnuplot_term) '$dumb)
(if (getf plot-options :gnuplot_dumb_term_command)
(setq terminal-command
@@ -294,7 +294,7 @@
(setq terminal-command "set term dumb 79 22"))
(if (getf plot-options :gnuplot_out_file)
(setq out-file (getf plot-options :gnuplot_out_file))
- (setq out-file "maxplot.txt")))
+ (setq out-file (format nil "~a.txt" (random-name 16)))))
((eq (getf plot-options :gnuplot_term) '$default)
(if (getf plot-options :gnuplot_default_term_command)
(setq terminal-command
diff --git a/src/plot.lisp b/src/plot.lisp
index fb2b3136b..8877f7025 100644
--- a/src/plot.lisp
+++ b/src/plot.lisp
@@ -1755,16 +1755,24 @@ plot3d([cos(y)*(10.0+6*cos(x)), sin(y)*(10.0+6*cos(x)),-6*sin(x)],
(defvar $xmaxima_plot_command "xmaxima")
+;; random-file-name
+;; Creates a random word of 'count' alphanumeric characters
+(defun random-name (count)
+ (let ((chars "0123456789abcdefghijklmnopqrstuvwxyz") (name ""))
+ (setf *random-state* (make-random-state t))
+ (dotimes (i count)
+ (setq name (format nil "~a~a" name (aref chars (random 36)))))
+ name))
+
(defun plot-set-gnuplot-script-file-name (options)
(let ((gnuplot-term (getf options :gnuplot_term))
(gnuplot-out-file (getf options :gnuplot_out_file)))
(if (and (find (getf options :plot_format) '($gnuplot_pipes $gnuplot))
(eq gnuplot-term '$default) gnuplot-out-file)
(plot-file-path gnuplot-out-file t options)
- (plot-file-path
- (format nil "maxout~d.~(~a~)"
- (getpid)
- (ensure-string (getf options :plot_format))) nil options))))
+ (plot-file-path (format nil "~a.~a" (random-name 16)
+ (ensure-string (getf options :plot_format)))
+ nil options))))
(defun plot-temp-file0 (file &optional (preserve-file nil))
(let ((filename
@@ -2577,9 +2585,13 @@ plot2d ( x^2+y^2 = 1, [x, -2, 2], [y, -2 ,2]);
(format dest "}~%"))
(format dest "}~%"))
+; TODO: Check whether this function is still being used (villate 20240325)
(defun show-open-plot (ans file)
(cond ($show_openplot
- (with-open-file (st1 (plot-temp-file (format nil "maxout~d.xmaxima" (getpid))) :direction :output :if-exists :supersede)
+ (with-open-file
+ (st1 (plot-temp-file
+ (format nil "~a.xmaxima" (random-name 16)))
+ :direction :output :if-exists :supersede)
(princ ans st1))
($system (concatenate 'string *maxima-prefix*
(if (string= *autoconf-windows* "true") "\\bin\\" "/bin/")
diff --git a/src/xmaxima_def.lisp b/src/xmaxima_def.lisp
index b6513b564..5a13b6141 100644
--- a/src/xmaxima_def.lisp
+++ b/src/xmaxima_def.lisp
@@ -431,7 +431,7 @@
(format $pstream "}~%"))))))
(defmethod plot-shipout ((plot xmaxima-plot) options &optional output-file)
- (let ((file (plot-file-path (format nil "maxout~d.xmaxima" (getpid)))))
+ (let ((file (plot-file-path (format nil "~a.xmaxima" (random-name 16)))))
(cond ($show_openplot
(with-open-file (fl
#+sbcl (sb-ext:native-namestring file)

View File

@@ -0,0 +1,125 @@
{
lib,
stdenv,
fetchurl,
fetchpatch,
texinfo,
perl,
python3,
makeWrapper,
autoreconfHook,
rlwrap ? null,
tk ? null,
gnuplot ? null,
lisp-compiler,
}:
let
# Allow to remove some executables from the $PATH of the wrapped binary
searchPath = lib.makeBinPath (
lib.filter (x: x != null) [
lisp-compiler
rlwrap
tk
gnuplot
]
);
in
stdenv.mkDerivation (finalAttrs: {
pname = "maxima";
version = "5.47.0";
src = fetchurl {
url = "mirror://sourceforge/maxima/maxima-${finalAttrs.version}.tar.gz";
sha256 = "sha256-kQQCGyT9U+jAOpg1CctC6TepJejAyFwzXXcJoU/UD3o=";
};
nativeBuildInputs = [
autoreconfHook
lisp-compiler
makeWrapper
python3
texinfo
];
strictDeps = true;
nativeCheckInputs = [
gnuplot
];
postPatch = ''
substituteInPlace doc/info/Makefile.am --replace "/usr/bin/env perl" "${perl}/bin/perl"
'';
postInstall = ''
# Make sure that maxima can find its runtime dependencies.
for prog in "$out/bin/"*; do
wrapProgram "$prog" --prefix PATH ":" "$out/bin:${searchPath}"
done
# Move documentation into the right place.
mkdir -p $out/share/doc
ln -s ../maxima/${finalAttrs.version}/doc $out/share/doc/maxima
''
+ (lib.optionalString (lisp-compiler.pname == "ecl") ''
cp src/binary-ecl/maxima.fas* "$out/lib/maxima/${finalAttrs.version}/binary-ecl/"
'');
patches = [
# fix path to info dir (see https://trac.sagemath.org/ticket/11348)
(fetchpatch {
url = "https://raw.githubusercontent.com/sagemath/sage/07d6c37d18811e2b377a9689790a7c5e24da16ba/build/pkgs/maxima/patches/infodir.patch";
sha256 = "09v64n60f7i6frzryrj0zd056lvdpms3ajky4f9p6kankhbiv21x";
})
# fix https://sourceforge.net/p/maxima/bugs/2596/
(fetchpatch {
url = "https://raw.githubusercontent.com/sagemath/sage/07d6c37d18811e2b377a9689790a7c5e24da16ba/build/pkgs/maxima/patches/matrixexp.patch";
sha256 = "06961hn66rhjijfvyym21h39wk98sfxhp051da6gz0n9byhwc6zg";
})
# undo https://sourceforge.net/p/maxima/code/ci/f5e9b0f7eb122c4e48ea9df144dd57221e5ea0ca
# see https://trac.sagemath.org/ticket/13364#comment:93
(fetchpatch {
url = "https://raw.githubusercontent.com/sagemath/sage/07d6c37d18811e2b377a9689790a7c5e24da16ba/build/pkgs/maxima/patches/undoing_true_false_printing_patch.patch";
sha256 = "0fvi3rcjv6743sqsbgdzazy9jb6r1p1yq63zyj9fx42wd1hgf7yx";
})
./5.47.0-CVE-2024-34490.patch
];
# The test suite is disabled since 5.42.2 because of the following issues:
#
# Error(s) found:
# /build/maxima-5.44.0/share/linearalgebra/rtest_matrixexp.mac problems:
# (20 21 22)
# Tests that were expected to fail but passed:
# /build/maxima-5.44.0/share/vector/rtest_vect.mac problem:
# (19)
# 3 tests failed out of 16,184 total tests.
#
# These failures don't look serious. It would be nice to fix them, but I
# don't know how and probably won't have the time to find out.
doCheck = false; # try to re-enable after next version update
enableParallelBuilding = true;
passthru = {
inherit lisp-compiler;
};
meta = with lib; {
description = "Computer algebra system";
homepage = "http://maxima.sourceforge.net";
license = licenses.gpl2Plus;
longDescription = ''
Maxima is a fairly complete computer algebra system written in
lisp with an emphasis on symbolic computation. It is based on
DOE-MACSYMA and licensed under the GPL. Its abilities include
symbolic integration, 3D plotting, and an ODE solver.
'';
maintainers = with maintainers; [ doronbehar ];
platforms = platforms.unix;
};
})

View File

@@ -0,0 +1,51 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
bison,
flex,
gitUpdater,
gmp,
gtk3,
pkg-config,
qtbase,
wrapQtAppsHook,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "mpsolve";
version = "3.2.2";
src = fetchFromGitHub {
owner = "robol";
repo = "MPSolve";
rev = "de7ebfc7afc4834a0c9f92a04be7abdf5943d446";
hash = "sha256-BGXvNxWUbto0yMIpEIxZ9wOYv9w0ev4OgVcniNYIKoU=";
};
nativeBuildInputs = [
autoreconfHook
bison
flex
pkg-config
wrapQtAppsHook
];
buildInputs = [
gmp
gtk3
qtbase
];
passthru.updateScript = gitUpdater { };
meta = {
homepage = "https://numpi.dm.unipi.it/scientific-computing-libraries/mpsolve/";
description = "Multiprecision Polynomial Solver";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ kilianar ];
mainProgram = "mpsolve";
platforms = lib.platforms.linux;
};
})

View File

@@ -0,0 +1,157 @@
{
lib,
stdenv,
autoPatchelfHook,
requireFile,
alsa-lib,
dbus,
fontconfig,
freetype,
gcc,
glib,
installShellFiles,
libssh2,
ncurses,
opencv4,
openssl,
unixODBC,
xkeyboard_config,
xorg,
zlib,
libxml2,
libuuid,
lang ? "en",
libGL,
libGLU,
wrapQtAppsHook,
}:
let
l10n = import ./l10ns.nix {
lib = lib;
inherit requireFile lang;
};
dirName = "WolframEngine";
in
stdenv.mkDerivation rec {
inherit (l10n) version name src;
nativeBuildInputs = [
autoPatchelfHook
installShellFiles
wrapQtAppsHook
];
dontWrapQtApps = true;
buildInputs = [
alsa-lib
dbus
fontconfig
freetype
gcc.cc
gcc.libc
glib
libssh2
ncurses
opencv4
openssl
(lib.getLib stdenv.cc.cc)
unixODBC
xkeyboard_config
libxml2
libuuid
zlib
libGL
libGLU
]
++ (with xorg; [
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
libXcursor
libXfixes
libXrandr
libICE
libSM
]);
# some bundled libs are found through LD_LIBRARY_PATH
autoPatchelfIgnoreMissingDeps = true;
ldpath =
lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") (
":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs
);
unpackPhase = ''
# find offset from file
offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
dd if="$src" ibs=$offset skip=1 | tar -xf -
cd Unix
'';
installPhase = ''
cd Installer
sed -i -e 's/^PATH=/# PATH=/' -e 's/=`id -[ug]`/=0/' MathInstaller
# Installer wants to write default config in HOME
export HOME=$(mktemp -d)
# Fix the installation script
patchShebangs MathInstaller
substituteInPlace MathInstaller \
--replace-fail '`hostname`' "" \
--replace-fail "chgrp" "# chgrp" \
--replace-fail "chown" ": # chown"
# Install the desktop items
export XDG_DATA_HOME="$out/share"
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/${dirName} -silent
# Fix library paths
cd $out/libexec/${dirName}/Executables
for path in MathKernel math mcc wolfram; do
makeWrapper $out/libexec/${dirName}/Executables/$path $out/bin/$path --set LD_LIBRARY_PATH "${zlib}/lib:${lib.getLib stdenv.cc.cc}/lib:${libssh2}/lib:\''${LD_LIBRARY_PATH}"
done
for path in WolframKernel wolframscript; do
makeWrapper $out/libexec/${dirName}/SystemFiles/Kernel/Binaries/Linux-x86-64/$path $out/bin/$path --set LD_LIBRARY_PATH "${zlib}/lib:${lib.getLib stdenv.cc.cc}/lib:${libssh2}/lib:\''${LD_LIBRARY_PATH}"
done
wrapQtApp "$out/libexec/${dirName}/SystemFiles/FrontEnd/Binaries/Linux-x86-64/WolframPlayer" \
--set LD_LIBRARY_PATH "${zlib}/lib:${lib.getLib stdenv.cc.cc}/lib:${libssh2}/lib:\''${LD_LIBRARY_PATH}" \
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb"
if ! isELF "$out/libexec/${dirName}/SystemFiles/FrontEnd/Binaries/Linux-x86-64/WolframPlayer"; then
substituteInPlace $out/libexec/${dirName}/SystemFiles/FrontEnd/Binaries/Linux-x86-64/WolframPlayer \
--replace-fail "TopDirectory=" "TopDirectory=$out/libexec/${dirName} #";
fi
for path in WolframPlayer wolframplayer; do
makeWrapper $out/libexec/${dirName}/Executables/$path $out/bin/$path
done
# Install man pages
installManPage $out/libexec/${dirName}/SystemFiles/SystemDocumentation/Unix/*
'';
# This is primarily an IO bound build; there's little benefit to building remotely.
preferLocalBuild = true;
# Stripping causes the program to core dump.
dontStrip = true;
meta = with lib; {
description = "Wolfram Engine computational software system";
homepage = "https://www.wolfram.com/engine/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = with maintainers; [ fbeffa ];
platforms = [ "x86_64-linux" ];
};
}

View File

@@ -0,0 +1,88 @@
{
lib,
requireFile,
lang,
majorVersion ? null,
}:
let
allVersions =
lib.flip map
# N.B. Versions in this list should be ordered from newest to oldest.
[
{
version = "14.1.0";
lang = "en";
language = "English";
sha256 = "1kxdvm3i7nn3ws784y972h2br1n0y82kkkjvz7c5llssv6d3pgj8";
installer = "WolframEngine_14.1.0_LIN.sh";
}
{
version = "13.3.0";
lang = "en";
language = "English";
sha256 = "96106ac8ed6d0e221a68d846117615c14025320f927e5e0ed95b1965eda68e31";
installer = "WolframEngine_13.3.0_LINUX.sh";
}
{
version = "13.2.0";
lang = "en";
language = "English";
sha256 = "1xvg1n64iq52jxnk9y551m5iwkkz6cxzwyw28h8d0kq36aaiky24";
installer = "WolframEngine_13.2.0_LINUX.sh";
}
{
version = "13.1.0";
lang = "en";
language = "English";
sha256 = "1659kyp38a8xknic95pynx9fsgn96i8jn9lnk89pc8n6vydw1460";
installer = "WolframEngine_13.1.0_LINUX.sh";
}
{
version = "13.0.1";
lang = "en";
language = "English";
sha256 = "1rrxi7d51m02407k719fq829jzanh550wr810i22n3irhk8axqga";
installer = "WolframEngine_13.0.1_LINUX.sh";
}
{
version = "13.0.0";
lang = "en";
language = "English";
sha256 = "10cpwllz9plxz22iqdh6xgkxqphl9s9nq8ax16pafjll6j9kqy1q";
installer = "WolframEngine_13.0.0_LINUX.sh";
}
]
(
{
version,
lang,
language,
sha256,
installer,
}:
{
inherit version lang;
name = "wolfram-engine-${version}" + lib.optionalString (lang != "en") "-${lang}";
src = requireFile {
name = installer;
message = ''
This nix expression requires that ${installer} is
already part of the store. Download the file from
https://www.wolfram.com/engine/ and add it to the nix store
with nix-store --add-fixed sha256 <FILE>.
'';
inherit sha256;
};
}
);
minVersion =
if majorVersion == null then
lib.elemAt (builtins.splitVersion (lib.elemAt allVersions 0).version) 0
else
majorVersion;
maxVersion = toString (1 + builtins.fromJSON minVersion);
in
lib.findFirst (
l: (l.lang == lang && l.version >= minVersion && l.version < maxVersion)
) (throw "Version ${minVersion} in language ${lang} not supported") allVersions

View File

@@ -0,0 +1,56 @@
{
lib,
stdenv,
fetchFromGitHub,
wrapGAppsHook3,
cmake,
gettext,
maxima,
wxGTK,
adwaita-icon-theme,
glib,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "wxmaxima";
version = "25.04.0";
src = fetchFromGitHub {
owner = "wxMaxima-developers";
repo = "wxmaxima";
rev = "Version-${finalAttrs.version}";
hash = "sha256-AEy2a8BahV1yH67RIjcsVipuo5eUZcQZxR3HygSYGlU=";
};
buildInputs = [
wxGTK
maxima
# So it won't embed svg files into headers.
adwaita-icon-theme
# So it won't crash under Sway.
glib
];
nativeBuildInputs = [
wrapGAppsHook3
cmake
gettext
];
cmakeFlags = [
"-DwxWidgets_LIBRARIES=${wxGTK}/lib"
];
preConfigure = ''
gappsWrapperArgs+=(--prefix PATH ":" ${maxima}/bin)
'';
meta = with lib; {
description = "Cross platform GUI for the computer algebra system Maxima";
mainProgram = "wxmaxima";
license = licenses.gpl2;
homepage = "https://wxmaxima-developers.github.io/wxmaxima/";
maintainers = with maintainers; [ doronbehar ];
platforms = platforms.linux;
};
})

View File

@@ -0,0 +1,90 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
cmake,
perl,
enableGui ? false,
qtbase,
wrapQtAppsHook,
qtwebengine,
enableJupyter ? true,
boost,
jsoncpp,
openssl,
zmqpp,
enableJava ? false,
openjdk,
gtest,
}:
stdenv.mkDerivation rec {
pname = "yacas";
version = "1.9.1";
src = fetchFromGitHub {
owner = "grzegorzmazur";
repo = "yacas";
rev = "v${version}";
sha256 = "0dqgqvsb6ggr8jb3ngf0jwfkn6xwj2knhmvqyzx3amc74yd3ckqx";
};
hardeningDisable = [ "format" ];
cmakeFlags = [
"-DENABLE_CYACAS_GUI=${if enableGui then "ON" else "OFF"}"
"-DENABLE_CYACAS_KERNEL=${if enableJupyter then "ON" else "OFF"}"
"-DENABLE_JYACAS=${if enableJava then "ON" else "OFF"}"
"-DENABLE_CYACAS_UNIT_TESTS=ON"
];
patches = [
# upstream issue: https://github.com/grzegorzmazur/yacas/issues/340
# Upstream patch which doesn't apply on 1.9.1 is:
# https://github.com/grzegorzmazur/yacas/pull/342
./jsoncpp-fix-include.patch
# Fixes testing - https://github.com/grzegorzmazur/yacas/issues/339
# PR: https://github.com/grzegorzmazur/yacas/pull/343
(fetchpatch {
url = "https://github.com/grzegorzmazur/yacas/commit/8bc22d517ecfdde3ac94800dc8506f5405564d48.patch";
sha256 = "sha256-aPO5T8iYNkGtF8j12YxNJyUPJJPKrXje1DmfCPt317A=";
})
];
preCheck = ''
patchShebangs ../tests/test-yacas
'';
nativeCheckInputs = [
gtest
];
doCheck = true;
nativeBuildInputs = [
cmake
# Perl is only for the documentation
perl
]
++ lib.optionals enableJava [
openjdk
];
buildInputs = [
]
++ lib.optionals enableGui [
qtbase
wrapQtAppsHook
qtwebengine
]
++ lib.optionals enableJupyter [
boost
jsoncpp
openssl
zmqpp
];
meta = {
description = "Easy to use, general purpose Computer Algebra System, optionally with GUI";
homepage = "http://www.yacas.org/";
license = lib.licenses.gpl2Plus;
maintainers = [ ];
platforms = with lib.platforms; linux;
};
}

View File

@@ -0,0 +1,63 @@
diff --git i/cyacas/yacas-kernel/CMakeLists.txt w/cyacas/yacas-kernel/CMakeLists.txt
index fe1600aa..dcc329f8 100644
--- i/cyacas/yacas-kernel/CMakeLists.txt
+++ w/cyacas/yacas-kernel/CMakeLists.txt
@@ -22,8 +22,9 @@ find_library (ZEROMQ_LIBRARY NAMES zmq)
find_path (ZMQPP_INCLUDE_DIR zmqpp.hpp)
find_library (ZMQPP_LIBRARY NAMES zmqpp)
-find_path (JSONCPP_INCLUDE_DIR json.h)
-find_library (JSONCPP_LIBRARY NAMES jsoncpp)
+# https://github.com/open-source-parsers/jsoncpp/wiki/Building#another-approach-for-cmake
+find_package(jsoncpp REQUIRED)
+get_target_property(JSON_INC_PATH jsoncpp_lib INTERFACE_INCLUDE_DIRECTORIES)
find_package (OpenSSL)
find_package (Boost REQUIRED date_time filesystem)
@@ -31,6 +32,6 @@ find_package (Boost REQUIRED date_time filesystem)
include_directories (include)
add_executable (yacas-kernel src/main.cpp src/yacas_kernel.cpp src/yacas_engine.cpp src/hmac_sha256.cpp src/base64.cpp)
-target_link_libraries (yacas-kernel libyacas ${ZMQPP_LIBRARY} ${ZEROMQ_LIBRARY} ${JSONCPP_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${Boost_LIBRARIES} pthread ${CMAKE_DL_LIBS})
+target_link_libraries (yacas-kernel libyacas ${ZMQPP_LIBRARY} ${ZEROMQ_LIBRARY} jsoncpp_lib ${OPENSSL_CRYPTO_LIBRARY} ${Boost_LIBRARIES} pthread ${CMAKE_DL_LIBS})
install (TARGETS yacas-kernel DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git i/cyacas/yacas-kernel/include/yacas_kernel.hpp w/cyacas/yacas-kernel/include/yacas_kernel.hpp
index 91d36ac0..d12f905c 100644
--- i/cyacas/yacas-kernel/include/yacas_kernel.hpp
+++ w/cyacas/yacas-kernel/include/yacas_kernel.hpp
@@ -29,7 +29,7 @@
#include "yacas_engine.hpp"
#include <boost/uuid/random_generator.hpp>
-#include <jsoncpp/json/json.h>
+#include <json/json.h>
#include <zmqpp/zmqpp.hpp>
#include <map>
diff --git i/cyacas/yacas-kernel/src/main.cpp w/cyacas/yacas-kernel/src/main.cpp
index c31f17f2..832e9128 100644
--- i/cyacas/yacas-kernel/src/main.cpp
+++ w/cyacas/yacas-kernel/src/main.cpp
@@ -24,7 +24,7 @@
#include "yacas_kernel.hpp"
-#include <jsoncpp/json/json.h>
+#include <json/json.h>
#include <boost/dll/runtime_symbol_info.hpp>
diff --git i/cyacas/yacas-kernel/src/yacas_engine.cpp w/cyacas/yacas-kernel/src/yacas_engine.cpp
index 6ed60ca3..18e9b3fd 100644
--- i/cyacas/yacas-kernel/src/yacas_engine.cpp
+++ w/cyacas/yacas-kernel/src/yacas_engine.cpp
@@ -22,7 +22,7 @@
* Created on November 7, 2015, 12:52 PM
*/
-#include <jsoncpp/json/writer.h>
+#include <json/writer.h>
#include "yacas_engine.hpp"