diff --git a/.gitignore b/.gitignore index 6dd6f65..d716090 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,3 @@ # # Most recent upstrem source /CppAD-20240000.3.tar.gz -/CppAD-20250000.0.tar.gz -/CppAD-20260000.0.tar.gz diff --git a/cppad.spec b/cppad.spec index b3b1612..2917aa0 100644 --- a/cppad.spec +++ b/cppad.spec @@ -10,26 +10,26 @@ # a changelog or other information that is better placed in the main package # instead of a -doc subpackage.' # -# year -# The year corresponding to this version -%define year 2026 -# -# soversion -# fedora uses its own soversion number for cppad_lib where -# 1.0 corresponds to year 2020 -%define soversion %[ %year - 2019 ] +# fedpkg lint: W: files-duplicate: +# the files user_guide.html index.html in directory /usr/share/doc/cppad +# are the same. This is because a redirect from index.hml to user_guide.html +# will not reload when user_guide.html changes. # +# fedora uses its own soversion number for cppad_lib +# 5.0 corresponds to version 20240000 +%define soversion 5.0 + # This is really an out of soruce build because the source is in the -# CppAD-%%{version} sub-directory of the source. The fedora macros are -# confused and need this defined true. +# CppAD-%%{version} sub-directory. The fedora macros are confused and need +# this defined true. %define __cmake_in_source_build 1 # ---------------------------------------------------------------------------- # Fedora Release starts with 1; see # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ Name: cppad -Version: %{year}0000.0 -Release: 1%{?dist} +Version: 20240000.3 +Release: 2%{?dist} Summary: C++ Algorithmic Differentiation (AD), %{name}-devel and %{name}-doc # License: EPL-2.0 OR GPL-2.0-or-later @@ -38,18 +38,15 @@ Source: %{url}/archive/%{version}/CppAD-%{version}.tar.gz # BuildRequires: gcc BuildRequires: gcc-c++ -BuildRequires: cmake >= 3.10 +BuildRequires: cmake >= 3.0 BuildRequires: make -BuildRequires: python-xrst >= 2025.0 -BuildRequires: python-sphinx_rtd_theme -BuildRequires: python-tomli -BuildRequires: python-sphinx-copybutton -BuildRequires: python-pyspellchecker -BuildRequires: python-furo - +BuildRequires: python-xrst >= 2024.0 +# python-xrst should auotmatically require python-toml +BuildRequires: python-toml %description -C++ Algorithmic Differentiation (AD) include and library files. +C++ Algorithmic Differentiation (AD) library file libcppad_lib.so; +see %{name}-devel and %{name}-doc. # --------------------------------------------------------------------------- %package devel @@ -68,17 +65,29 @@ Given a C++ algorithm that computes function values, %{name} generates an algorithm that computes its derivative values. A brief introduction to Algorithmic Differentiation (AD) can be found at http://en.wikipedia.org/wiki/Automatic_differentiation -The documentation for the %{year} version - https://cppad.readthedocs.io/stable-%{year} -The documentation for the most recent version of %{name} can be found at - https://cppad.readthedocs.io/latest +See the package %{name}-doc for documentation of this version of %{name}. +The documentation, for the most recent version of %{name}, can be found at + https://cppad.readthedocs.io + +# ---------------------------------------------------------------------------- +%package doc +Summary: Documentation for %{name}-devel +BuildArch: noarch + +%description doc +The %{name}-doc package installs the HTML documentation for this version +of %{name}-devel in + %{_docdir}/%{name} +The documentation, for the most recent version of %{name}, can be found at + https://cppad.readthedocs.io + # ----------------------------------------------------------------------------- # prep # ----------------------------------------------------------------------------- %prep # # Create an empty directory named cppad-%%{version}, -# changed into that directory and unpack Source. +# changed into that directory and unpack Source0 and Source1. %setup -q -c # # xrst.toml @@ -88,16 +97,64 @@ echo '' >> CppAD-%{version}/xrst.toml echo '[input_files]' >> CppAD-%{version}/xrst.toml echo 'data = [ ]' >> CppAD-%{version}/xrst.toml # -# COPYING, uw_copy_040507.html -cp CppAD-%{version}/COPYING COPYING -cp CppAD-%{version}/uw_copy_040507.html uw_copy_040507.html +# Epel9: does not yet have spellchecker so use pyenchant +echo '[spell_package]' >> CppAD-%{version}/xrst.toml +echo "data = 'pyenchant'" >> CppAD-%{version}/xrst.toml +# # -# cppad_lib/CMakeLists.txt +# CppAD-%%{version}/build/html +# run xrst to create the documentation files in the directory above. +# +# Epel9: Sphinx before 4.0 does not support root_doc file specification so use +# rst_only and then move xrst_root_doc.rst -> index.rst before runing sphinx. +# +mkdir CppAD-%{version}/build +xrst --version +number_jobs=$(echo %{?_smp_mflags} | sed -e 's|[^0-9]*\([0-9]*\)[^0-9]*|\1|') +if [ "$number_jobs" == '' ] +then + number_jobs='1' +fi +xrst \ + --rst_only \ + --config_file CppAD-%{version}/xrst.toml \ + --local_toc \ + --target html \ + --html_theme sphinx_rtd_theme \ + --index_page_name user_guide \ + --group_list default app \ + --number_jobs $number_jobs \ + --suppress_spell_warnings +# +# Epel9: +cd CppAD-%{version}/build +mv rst/xrst_root_doc.rst rst/index.rst +sphinx-build -b html rst html -j $number_jobs +rm -r html/_sources +mv rst/_sources html/_sources +cd ../.. +# +# CppAD-%%{version}/build/html +# remove hidden files not needed for viewing documentation +rm CppAD-%{version}/build/html/.buildinfo +rm -r CppAD-%{version}/build/html/.doctrees + +# +# COPYING, uw_copy_040507.html +mv CppAD-%{version}/COPYING COPYING +mv CppAD-%{version}/uw_copy_040507.html uw_copy_040507.html +# +# ---------------------------------------------------------------------------- # cppad_lib: replace soversion number and ensure build type is release sed -i.bak CppAD-%{version}/cppad_lib/CMakeLists.txt \ -e "s|print_variable(soversion)|SET(soversion %{soversion} )\n&|" \ -e "s|\${cppad_debug_which}|debug_none|" # +# Bug fix to version 20240000.3 (not necessary in version 20240000.4 or higher) +sed -z -i.bak CppAD-%{version}/include/cppad/local/val_graph/fun2val.hpp \ + -e 's|\n *break;\(\n[^\n]*}\n[^\n]*-\n[^\n]*else switch(var_op)\n\)|\1|' +# +# ---------------------------------------------------------------------------- # Print machine epsilon before any other testing cat << EOF > temp.cpp # include @@ -117,14 +174,26 @@ g++ -std=c++11 temp.cpp -o temp ./temp > temp.out cat temp.out # ---------------------------------------------------------------------------- +# Comment out test of to_string long double on ppc64le arch. Understanding why +# it is failing will have to wait until there is a fedora 36 ppc64le test machine. +if [ "%{_arch}" == 'ppc64le' ] +then + sed -i.bak CppAD-%{version}/example/utility/to_string.cpp \ + -e 's|ok *&= *floating();|// &|' +fi +# ----------------------------------------------------------------------------- # build # ----------------------------------------------------------------------------- %build # -# 1. The debug_all is overridden for cppad_lib by the edit of +# 1. Cannot use %%{_includedir}, %%{_libdir}, %%{_datadir}, %%{_docdir} +# because they are absolute paths. Relative values would be more flexible +# because they can be combined with %%{_prefix} to get absolute values. +# +# 2. The debug_all is overridden for cppad_lib by the edit of # cppad_lib/CMakeLists.txt above # -# 2. The gnu c++ compiler seems to be generating an incorrect warning about +# 3. The gnu c++ compiler seems to be generating an incorrect warning about # array bounds in thread_alloc.hpp. Use -Wno-array-bounds to suppress it. # # cppad_cxx_flags @@ -158,14 +227,10 @@ cppad_cxx_flags=\ -D cmake_install_libdirs=%{_lib} \ \ -D cmake_install_datadir=share \ - -D cmake_install_docdir='NOTFOUND' \ - \ - -D include_doc=true \ - -D cmake_defined_ok=false \ - -D cppad_static_lib=false \ - -D cppad_debug_and_release=true \ + -D cmake_install_docdir=share/doc \ \ -D include_adolc=false \ + -D include_eigen=false \ -D include_ipopt=false \ -D include_cppadcg=false \ \ @@ -178,8 +243,9 @@ cppad_cxx_flags=\ -D cppad_testvector=cppad \ -D cppad_max_num_threads=64 \ -D cppad_tape_id_type=size_t \ - -D cppad_tape_addr_type='unsigned int' \ - -D cppad_debug_which='debug_all' + -D cppad_tape_addr_type=size_t \ + -D cppad_debug_which='debug_all' \ + -D cppad_debug_and_release=true # # see https://docs.fedoraproject.org/en-US/packaging-guidelines/ # parallel_make @@ -199,75 +265,36 @@ cppad_cxx_flags=\ # These documentation files come from the source code tarball %doc COPYING uw_copy_040507.html - %files devel %{_includedir}/%{name} %{_datadir}/pkgconfig/%{name}.pc %{_libdir}/pkgconfig/%{name}.pc %{_libdir}/libcppad_lib.so +%files doc +# These documentation files are build by the xrst command above +%{_docdir}/%{name} + # ----------------------------------------------------------------------------- # Check # ----------------------------------------------------------------------------- -# +# use the installed include files to compile and run the tests %check -# -# Test installed version of CppAD -g++ CppAD-%{version}/example/get_started/get_started.cpp \ - -I %{buildroot}/%{_includedir} \ - -Wl,-rpath,%{buildroot}/%{_libdir} \ - %{buildroot}/%{_libdir}/libcppad_lib.so \ - -o get_started -./get_started -# -# Test building documentation -make %{?_smp_mflags} doc_user -# -# Run the all the standard CppAD tests. make %{?_smp_mflags} check # ---------------------------------------------------------------------------- -# +# %%clean # Use %%clean with no arguments to surpress the cleanup of BUILDROOT # This enables one to check that the necessary files are installed. -%%clean # ---------------------------------------------------------------------------- %changelog -* Mon Jan 05 2026 Brad Bell - 20260000.0-1 -- New upstream source cppad-20260000.0. - -* Wed Jul 23 2025 Fedora Release Engineering - 20250000.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Wed Feb 05 2025 - 20250000.0-4 -- python-toml is deprecated, so current xrst-python uses python-tomli instead - -* Sun Jan 19 2025 Brad Bell - 20250000.0-3 -- 1. Add the year macro and use it to define soversion and Version. -- 2. Remove the cppad-doc subpackage because documantion for this stable - version is not available at https://cppad.readthedocs.io/stable-2025/ . -- 3. Change include_doc=true, cmake_install_docdir=NOTFOUND, and add - make doc_user to test building, but not installing, user documentation. -- 4. The ppc64le arch has been fixed and now the CppAD to_string test pass - for long double (so we do not need to skip that test). -- 5. Use get_started.cpp to test the installed version of CppAD. - -* Sat Jan 18 2025 Brad Bell - 20250000.0-2 -- This fixes two bugs and will not be necessary -- once the upstream source advances to 20250000.1. - -* Thu Jan 16 2025 Fedora Release Engineering - 20250000.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Tue Jan 14 2025 Brad Bell - 20250000.0-1 -- New upstream source cppad-20250000.0. - -* Wed Jul 17 2024 Fedora Release Engineering - 20240000.3-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Fri Mar 01 2024 Brad Bell - 20240000.3-2 +* Sat Mar 01 2024 Brad Bell - 20240000.3-2 - This fixes a bug in fun2val.hpp. This change will not be necessary - once the upstream source advances to 20240000.4. +* Tue Feb 20 2024 Brad Bell - 20240000.3-1 +- Use in current rawhide to replace cppad.spec as first commit. +- Make changes needed for epel9 as second commit; See Epel9 in comments above. + * Sat Feb 17 2024 Brad Bell - 20240000.3-1 - This fixes a long standing bug; see the heading 02-14 on - https://cppad.readthedocs.io/latest/whats_new_24.html diff --git a/get_tarball.sh b/get_tarball.sh deleted file mode 100755 index daf2942..0000000 --- a/get_tarball.sh +++ /dev/null @@ -1,16 +0,0 @@ -# /usr/bin/env bash -set -e -u -# -version=$(sed -n cppad.spec -e '/^Version:/p' | sed -e 's|^Version: *||') -url=$(sed -n cppad.spec -e '/^URL:/p' | sed -e 's|^URL: *||') -local_tarball="CppAD-${version}.tar.gz" -remote_tarball="$url/archive/$version/$local_tarball" -if [ -e "$local_tarball" ] -then - echo "get_tarball.sh: $local_tarball already exists" - exit 1 -fi -wget $tarball -# -echo 'get_tarball.sh: OK' -exit 0 diff --git a/sources b/sources index 8f40433..1ed1dbc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (CppAD-20260000.0.tar.gz) = abe9dd9a971f8d154990d54c1f798c8cab6bf90d016bb288efbcb23a14331897762610295658eec04fb50e5c13b05f4bb6b50a4647d6f0468eb94833dc3400d2 +SHA512 (CppAD-20240000.3.tar.gz) = 8a542df030a885a2a801634414e309aae1f546395a2e41e40bae2b553de00569ce17b2761eceea962d242382abe5ce6bf561bf9a6b476594ab802b9aa6f66000