%global commit ec978013cbc07f96384ae56ec5f1d6f5e84f93ce %global shortcommit %(c=%{commit}; echo ${c:0:7}) %{!?tcl_version: %global tcl_version %(echo 'puts $tcl_version' | tclsh)} %{!?tcl_sitearch: %global tcl_sitearch %{_libdir}/tcl%{tcl_version}} %{?python_enable_dependency_generator} Name: linuxcnc %global name_uc LinuxCNC Version: 2.10.0 Release: 19%{?dist} Summary: Realtime and Simulated CNC Control License: GPL-2.0-or-later AND LGPL-2.0-only AND LGPL-2.1-or-later AND BSL-1.0 AND Apache-2.0 AND BSD-1-Clause AND FSFAP AND MIT URL: http://linuxcnc.org/ Source0: https://github.com/%{name_uc}/%{name}/tarball/%{shortcommit} #Patch3: %%{name}-0003-Allow-to-overwrite-default-CXXFLAGS.patch #Patch4: %%{name}-0004-Make-sure-all-compilations-honors-CPPFLAGS.patch BuildRequires: automake gcc-c++ zlib-devel libasan libtsan BuildRequires: pkgconfig(libudev) pkgconfig(libusb-1.0) pkgconfig(libtirpc) BuildRequires: pkgconfig(glib-2.0) pkgconfig(gtk+-3.0) BuildRequires: procps kmod python3-Yapps intltool tcl-devel tk-devel BuildRequires: bwidget tkimg tclx python3-gobject readline-devel python3-tkinter BuildRequires: boost-python3-devel libGLU-devel libXmu-devel python3-devel BuildRequires: desktop-file-utils psmisc ImageMagick asciidoc help2man BuildRequires: python3-pyupgrade Requires: tcl-%{name} = %{version} Requires: python3-%{name} = %{version} Requires: bwidget, python3-tkinter, boost-python3, tkimg, pygtk2, xdg-utils Requires: python3-pyopengl python3-qt5 python3-scipy blt Requires: glade gtksourceview2 # if this is an initial installation, require the config, for an update # the user probably already has a configuration in his home directory Recommends: %{name}-config = %{version} Obsoletes: %{name} < 2.0.9-6 %description %{name_uc} controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more. This package only builds the simulated version! %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} #AutoReq: No %description devel Development files for %{name} %package config Summary: Sample configuration files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{python3} Buildarch: noarch %description config Configuration files for %{name}. Examples to use for initialization of different machines. Required for initial installation, application won't start without an initial configuration. %package doc Summary: Documentation for %{name} Buildarch: noarch %description doc Documentation for %{name}. Note that this is a parking spot for a bunch of desktop files that don't link to anything. %package -n tcl-%{name} Summary: Tcl files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Provides: tcl(Hal) = %{version} tcl(Linuxcnc) = %{version} tcl(Ngcgui) = %{version} %description -n tcl-%{name} Tcl files for %{name} %package -n python3-%{name} Summary: Python files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} AutoReq: no %description -n python3-%{name} Python files for %{name} %prep #%%{gpgverify} %autosetup -p1 -n %{name_uc}-%{name}-%{shortcommit} %build export CPPFLAGS="$(pkg-config --cflags python3)" export CPPFLAGS="-I%{_includedir}/readline5" export LDFLAGS="-L%{_libdir}/readline5 %{build_ldflags}" export CXXFLAGS="%{optflags} -Wl,--as-needed" sed -i 's#lib/tcltk/linuxcnc#%{tcl_sitearch}/linuxcnc%{version}#g' \ lib/python/rs274/options.py %if 0%{?fedora} >= 39 sed -i 's#python3.11 python3.10#python3.12 python3.11 python3.10#g' \ src/m4/ax_python.m4 %endif # update FSF address... damn, those guys move around a lot # ... anyways, better make sure they get their mail %global oa1 675 Mass Ave, Cambridge, MA 02139, USA %global oa2 59 Temple Place, Suite 330, Boston, MA\\s+02111(\\-1307)?\\s+USA %global an 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA %global re_oa %{oa1}|%{oa2} set +x echo "Updating FSF address:" for f in `find . -type f -regextype posix-extended -regex '.*\.(c|cc|h|hh|scm|py|pl|inx|tcl|txt)$'`; do if grep -zqP "%{re_oa}" $f; then perl -0777 -i -pe 's/%{re_oa}/%{an}/g' $f echo "$f" fi done set -x # Correct depricated regex syntax -> SyntaxWarning: invalid escape sequence pyupgrade --exit-zero-even-if-changed src/emc/ini/update_ini.py pyupgrade --exit-zero-even-if-changed src/emc/usr_intf/qtplasmac/qtplasmac-materials.py pyupgrade --exit-zero-even-if-changed src/emc/usr_intf/pncconf/data.py pyupgrade --exit-zero-even-if-changed src/emc/usr_intf/stepconf/stepconf.py pyupgrade --exit-zero-even-if-changed lib/python/linux_event.py pyupgrade --exit-zero-even-if-changed lib/python/pyngcgui.py pyupgrade --exit-zero-even-if-changed lib/python/qtvcp/lib/gcode_utility/hole_circle.py pyupgrade --exit-zero-even-if-changed lib/python/qtvcp/lib/qt_ngcgui/ngcgui.py pyupgrade --exit-zero-even-if-changed lib/python/qtvcp/lib/ripper/gcode_ripper.py pyupgrade --exit-zero-even-if-changed lib/python/qtvcp/widgets/basic_probe.py pyupgrade --exit-zero-even-if-changed lib/python/qtvcp/widgets/versa_probe.py pyupgrade --exit-zero-even-if-changed tests/trajectory-planner/circular-arcs/run_all_tests.py pyupgrade --exit-zero-even-if-changed tests/motion-logger/basic/test-ui.py if [ 0 ]; then for f in %{name}.in rip-environment.in ; do sed -i -e 's#\(export PYTHONPATH.*\)#PYTHONPATH=$PYTHONPATH:"%{python3_sitelib}/%{name}"\n\1#g' scripts/$f done sed -i -e 's#\(export PYTHONPATH.*\)#PYTHONPATH=$$PYTHONPATH:"%{python3_sitelib}/%{name}"\n\1#g' src/Makefile %global py_env %{expand:\\ else \\ if [ -z \\"\\$PYTHONPATH\\" ]; then \\ PYTHONPATH=\\$LINUXCNC_HOME/lib/python \\ else \\ PYTHONPATH=\\$LINUXCNC_HOME/lib/python:\\"\\$PYTHONPATH\\" \\ fi \\ PYTHONPATH=\\$PYTHONPATH:"%{python3_sitelib}/%{name}" \\ export PYTHONPATH } for f in latency-test; do sed -i -e 's#\(\. $SCRIPT_LOCATION/rip-environment\)#\1%{py_env}#g' scripts/$f done for f in stepconf; do sed -i -e 's#\(import sys\)#\1\nsys.path.append("%{python3_sitelib}/%{name}")#g' src/emc/usr_intf/$f/$f.py done for f in stepconf; do sed -i -e 's#\(import sys\)#\1\nsys.path.append("%{python3_sitelib}/%{name}")#g' src/emc/usr_intf/$f/$f.py done for f in melfagui; do sed -i -e 's#\(from vismach import *\)#import sys\nsys.path.append("%{python3_sitelib}/%{name}")\n\1#g' src/hal/user_comps/vismach/$f.py done fi #export CPPFLAGS="${CPPFLAGS} -fsanitize=undefined -fPIE -fno-omit-frame-pointer" #export CPPFLAGS="${CPPFLAGS} -fPIE" pushd src sed -i -e 's#\(EMC2_TCL_DIR=\)${prefix}/lib/tcltk/%{name}#\1%{tcl_sitearch}/%{name}%{version}#g' \ -e 's#\(EMC2_TCL_LIB_DIR=\)${prefix}/lib/tcltk/%{name}#\1%{tcl_sitearch}/%{name}%{version}#g' \ -e 's#\(EMC2_LANG_DIR=\)${prefix}/share/%{name}/tcl/msgs#\1%{tcl_sitearch}/%{name}/tcl/msgs#g' \ -e 's#\(EMC2_RTLIB_DIR=\)${prefix}/lib/%{name}#\1%{_libdir}/%{name}#g' \ configure.ac autoreconf -ifv #--disable-build-documentation \ %configure --enable-non-distributable=yes \ --without-libmodbus \ --with-realtime=uspace \ --with-boost-python=boost_python%{python3_version_nodots} %set_build_flags %make_build %install pushd src %make_install SITEPY=%{python3_sitelib} \ DESTDIR=%{buildroot} \ DIR="install -p -d -m 0755" \ EXE="install -p -m 0755" \ FILE="install -p -m 0644" \ SETUID="install -p -m 0755" popd # move X11 app-defaults to the correct location mv %{buildroot}%{_sysconfdir}/X11 %{buildroot}%{_datadir}/ # linuxcnc.x86_64: E: shared-library-not-executable chmod +x %{buildroot}%{_libdir}/lib{posemath,pyplugin,rs274,tooldata}.so.0 chmod +x %{buildroot}%{_libdir}/lib{linuxcnchal,linuxcncini,nml}.so.0 # install icon files for x in 16 32 48; do mkdir -p %{buildroot}%{_datadir}/icons/hicolor/$x'x'$x/apps convert linuxcncicon.png -resize $x'x'$x -background transparent -extent $x'x'$x \ %{buildroot}%{_datadir}/icons/hicolor/$x'x'$x/apps/linuxcncicon.png done # icon file is installed in a fixed-size directory, but has a largely incorrect # size. Some desktop environments (e.g. GNOME) display them incorrectly. for icon in dimensions fullscreen_close fullscreen_open \ jog_speed_fast jog_speed_slow select_file \ skip_optional_active skip_optional_inactive; do convert %{buildroot}%{_datadir}/gmoccapy/icons/classic/32x32/actions/$icon.png \ -resize 32x32 -gravity center -background transparent -extent 32x32 \ %{buildroot}%{_datadir}/gmoccapy/icons/classic/32x32/actions/$icon.png done # install desktop files for app in debian/extras/usr/share/applications/*.desktop; do desktop-file-install \ --dir %{buildroot}%{_datadir}/applications \ ${app} done # not sure if/why 'lib' can't be hardcoded %global _lib32 /lib # correct tcl/tk installation directory install -d %{buildroot}%{tcl_sitearch} mv %{buildroot}%{_prefix}%{_lib32}/tcltk/%{name} %{buildroot}%{tcl_sitearch}/%{name}%{version} rm -rf %{buildroot}%{_prefix}%{_lib32}/tcltk # not sure why the sample configs dir structure got broken up, but we'll restore it # mv %%{buildroot}%%{_datadir}/%%{name}/ncfiles %%{buildroot}%%{_docdir}/%%{name}/examples/nc_files # rm -rf %%{buildroot}%%{_datadir}/%%{name}/ncfiles %global _simdir /examples/sample-configs/sim ln -sf ../../../../..%{_datadir}/%{name}/ncfiles %{buildroot}%{_docdir}/%{name}/examples/nc_files # these still lint as dangling, but they do in fact work. 'nc_files' is a symlink itself #ln -sf ../../../../../nc_files/remap-subroutines/qt_auto_probe_tool.ngc \ # %%{buildroot}%%{_docdir}/%%{name}%%{_simdir}/qtdragon/qtdragon_tool_probe/python/qt_auto_probe_tool.ngc #ln -sf ../../../../../nc_files/remap_lib/python-stdglue/stdglue.py \ # %%{buildroot}%%{_docdir}/%%{name}%%{_simdir}/qtdragon/qtdragon_tool_probe/python/stdglue.py ln -sf ../../../../../nc_files/remap-subroutines/qt_auto_probe_tool.ngc \ %{buildroot}%{_docdir}/%{name}%{_simdir}/woodpecker/python/qt_auto_probe_tool.ngc echo "Checking 'nc_files' is not a file" if [ -f %{buildroot}%{_docdir}/%{name}/examples/nc_files ]; then # -delete rm %{buildroot}%{_docdir}/%{name}/examples/nc_files echo " file 'nc_files' deleted!" fi pyupgrade --exit-zero-even-if-changed %{buildroot}/%{_bindir}/halcompile # fix a bunch of line endings sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/axis/vismach/VMC_toolchange/table.stl sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/axis/vismach/VMC_toolchange/saddle.stl sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/axis/vismach/VMC_toolchange/head.stl sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/axis/vismach/VMC_toolchange/carousel.stl sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/axis/vismach/VMC_toolchange/base.stl sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/axis/vismach/VMC_toolchange/arm.stl sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/woodpecker/compensate.py sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/woodpecker/help_files/help.css sed -i 's/\r$//' %{buildroot}%{_docdir}/%{name}%{_simdir}/woodpecker/woodpecker_/images/'QTvcp Widgets_files'/blank_data/inject.css sed -i 's/\r$//' %{buildroot}%{_bindir}/z_level_compensation # spurious-executable-perm chmod -x %{buildroot}%{_docdir}/%{name}%{_simdir}/woodpecker/tool_icons/{\ ball_end_mill,ballend_straight,center_drill,drill,spiral_ball_end,probe,\ gauge,not_found,spiral_downcut_2F,spiral_upcut,surfacing,tapered_ball_end,\ upcut_spiral,vbit-60,vbit-90,vbit-90deg}.png # TODO convert setup_designer to Fedora. For now, just give a message and exit sed -i -e 's|\(#!/bin/bash\)|\1\n\necho -e "\nSetup Designer needs to be rewritten for Fedora.\n"\ echo -e "You will need to access the raw file in your %{_bindir} directory"\ echo -e "and convert packages, commands, and directories to their Fedora"\ echo -e "equivalents.\n"\n\nexit|' %{buildroot}%{_bindir}/setup_designer # a primitive help message sed -i -e 's#\(import sys\)#\1\ if len(sys.argv) > 1:\ print("Z level compensation")\ print("for LinuxCNC")\ sys.exit()\n\n#' %{buildroot}%{_bindir}/z_level_compensation #tool_mmap_read # generate missing man pages for app in melfagui millturngui modcompile qtplasmac_gcode \ tool_watch xyzab-tdr-gui setup_designer z_level_compensation; do help2man --no-discard-stderr "%{buildroot}%{_bindir}/$app" \ --version-option=version --output=%{buildroot}%{_mandir}/man1/$app.1 done # some symlinks were shifted, probably when their config dirs were 'orphaned' # these are my best guesses as to where they pointed to originally ln -sfn ../../remap/rack-toolchange/nc_subroutines %{buildroot}%{_docdir}/%{name}%{_simdir}/axis/orphans/iocontrol-removed/nc_subroutines ln -sfn ../../panelui-demo/tool.tbl %{buildroot}%{_docdir}/%{name}%{_simdir}/axis/orphans/iocontrol-removed/tool.tbl # the .so-s don't strip to the satisfaction of the linter, # maybe they're just shy for f in `find %{buildroot}/ -name '*.so*'`; do strip -sv $f; done # remove the shebang line in python library modules for lib in `find %{buildroot}%{python3_sitelib}/ -type f -regex '.*\.py'` \ %{buildroot}%{_datadir}/qtvcp/panels/spindle_belts/spindle_belts_handler.py; do sed '1{\@^#!/usr/bin/\(env \|\)python@d}' $lib > $lib.new && touch -r $lib $lib.new && mv $lib.new $lib done # delete some zero length files find %{buildroot}/%{tcl_sitearch}/%{name}%{version}/ -size 0 -delete find %{buildroot}%{_docdir}/%{name}/examples/sample-configs/ -size 0 -delete %check %{make_build} -C src pycheck V=1 #./scripts/runtests -u tests/build/ %find_lang %{name} %find_lang gmoccapy %files -f gmoccapy.lang -f %{name}.lang %{_bindir}/* %{_libdir}/%{name} %{_prefix}%{_lib32}/%{name} %{_mandir}/man?/* %config(noreplace) %{_sysconfdir}/%{name} #%%{_sysconfdir}/init.d/realtime %{_datadir}/applications/%{name}.desktop %{_datadir}/applications/%{name}-stepconf.desktop %{_datadir}/applications/%{name}-latency.desktop %exclude %{_datadir}/applications/%{name}-latency-histogram.desktop %exclude %{_datadir}/applications/%{name}-pncconf.desktop # share ownership if this dir with xorg. %{_datadir}/X11/app-defaults/Tk%{name_uc} %{_libdir}/lib*.so.0 #%%{_libdir}/%%{name}/canterp.so %exclude %{_libdir}/*.a %{_datadir}/icons/hicolor/??x??/apps/%{name}icon.png %license COPYING COPYING.more %exclude %{_mandir}/man3/MODULE_LICENSE.3rtapi.gz %license %{_mandir}/man3/MODULE_LICENSE.3rtapi.gz %doc TODO ISSUE_TEMPLATE.md docs/README.adoc #%%{python3_sitelib}/%%{name}/* %files config %{_docdir}/%{name} %{_datadir}/%{name} %{_datadir}/axis %{_datadir}/glade/catalogs/hal_python.xml %{_datadir}/glade/pixmaps/hicolor/22x22/actions/widget-gladevcp-*.png %{_datadir}/gmoccapy %{_datadir}/gscreen %{_datadir}/gtksourceview-2.0/language-specs/*.lang %{_datadir}/qtvcp %exclude %{_docdir}/%{name}/examples/sample-configs/sim/qtplasmac/LICENSE #%%license %%{_docdir}/%%{name}/examples/sample-configs/sim/qtplasmac/LICENSE %exclude %{_datadir}/gmoccapy/icons/material/LICENSE #%%license %%{_datadir}/gmoccapy/icons/material/LICENSE %exclude %{_datadir}/gmoccapy/icons/material-light/LICENSE #%%license %%{_datadir}/gmoccapy/icons/material-light/LICENSE %license COPYING COPYING.more %doc configs/maintainer.txt %files doc %exclude %{_datadir}/applications/%{name}-[d,g,h,i,m,u]*.desktop %license COPYING COPYING.more %doc README.md docs/README.adoc docs/AUTHORS %files -n tcl-%{name} %{tcl_sitearch}/%{name}%{version} %license COPYING COPYING.more %doc TODO README.md %files -n python3-%{name} %{python3_sitelib}/* %license COPYING COPYING.more %doc TODO README.md %files devel %{_includedir}/%{name}/ %{_libdir}/lib*.so #%%{_datadir}/%%{name}/ncfiles/M102.c <- actually a config file %license COPYING COPYING.more %doc TODO README.md %changelog * Wed Feb 14 2024 pappy 2.10.0-19 - Latest upstream, happy Valentine's * Sun Jan 21 2024 pappy 2.10.0-18 - Latest upstream * Thu Jan 04 2024 pappy 2.10.0-17 - Latest upstream * Wed Dec 27 2023 pappy 2.10.0-16 - Latest upstream * Sat Dec 02 2023 pappy 2.10.0-15 - Latest upstream * Sun Nov 19 2023 pappy 2.10.0-14 - Latest upstream - drop libgpoid-devel requirement * Sun Sep 24 2023 pappy 2.10.0-13 - Latest upstream - Drop python files back into site-python. There has to be - an easier way ... * Tue Jul 11 2023 pappy 2.10.0-12 - Latest upstream - Yapps update for fedora-review * Sun May 07 2023 pappy 2.10.0-11 - Latest upstream * Tue Apr 18 2023 pappy 2.10.0-10 - Hoist python files out of site-python to - site-python/linuxcnc - Restore Axis DRO OpenGL readouts, fixed upstream * Sun Mar 19 2023 pappy 2.10.0-9 - FSF address correction built into spec file * Mon Mar 06 2023 pappy 2.10.0-8 - latest upstream * Fri Feb 17 2023 pappy 2.10.0-7 - latest upstream * Wed Feb 08 2023 pappy 2.10.0-6 - glnav.py patch * Wed Feb 08 2023 pappy 2.10.0-5 - Latest upstream * Sat Feb 04 2023 pappy 2.10.0-4 - One more try at this OpenGL thing with the latest upstream * Fri Feb 03 2023 pappy 2.10.0-3 - move sample config files back to their original location - and adjust symlinks accordingly * Wed Feb 01 2023 pappy 2.10.0-2 - Sebastian Kuzminsky's - force pyOpenGL to GLX patch * Sun Jan 29 2023 pappy 2.10.0-1 - Stopped running, update to latest upstream * Sun Nov 27 2022 pappy 2.9.0-11 - Update to Fedora 37 * Wed Sep 21 2022 pappy 2.9.0-10 - Update to latest source * Wed Sep 21 2022 pappy 2.9.0-9 - Update to Fedora 36 * Fri Nov 19 2021 pappy 2.9.0-8 - Update to latest source * Fri Nov 19 2021 pappy 2.9.0-7 - Update to Fedora 35 * Fri Jan 22 2021 pappy 2.9.0-7 - Moved .desktop files that launch documentation into - doc package (there are some targets in the source - but they don't get built (or just not installed?)) - Renamed doc package config and made it required because - axis won't run without at least one configuration - file. * Thu Dec 31 2020 pappy 2.9.0-6 - py 3.9 removed array.tostring() function x 3 - Yippie, it works! * Thu Dec 31 2020 pappy 2.9.0-5 - py 3.9 removed array.tostring() function x 2 * Thu Dec 31 2020 pappy 2.9.0-4 - py 3.9 removed array.tostring() function * Thu Dec 31 2020 pappy 2.9.0-3 - Install config files * Tue Sep 1 2020 pappy 2.9.0-2 - My shot at a package for this * Tue Sep 1 2020 spike 2.9.0-2.20200901giteac9994 - Updated to lastest git common on upstream master branch - Added 'AutoReq: No' to -devel package since rpm is silly :( - Fixed globs for shared object files according to fedora packaging - guidelines (specify version explicitly) - Fixed ambiguous python shebang of qtdragon_handler.py * Mon Jun 15 2020 spike 2.9.0-1.20200615gitcda96a4 - Updated to lastest git common on upstream master branch * Sun Feb 23 2020 spike 2.7.15-1 - Updated to new upstream release 2.7.15 - Updated BuildRequires - Added 'AutoReq: no' to python-linuxcnc - Changed AutoReqProv to AutoReq - Fixed python2 related rpm macros * Sun Feb 23 2020 spike 2.7.14-4 - Added pygtk2 to Requires for Fedora 31+ * Mon May 20 2019 spike 2.7.14-3 - Fixed ambiguous shebangs for Fedora 30+ - Added python-Yapps and python2-gobject to BuildRequires - Dropped support for Fedora 28 and older * Sat Feb 2 2019 spike 2.7.14-2 - Updated build requirements for fedora 29+ * Tue Jun 19 2018 spike 2.7.14-1 - Updated to new upstream release 2.7.14 * Tue May 15 2018 spike 2.7.13-2 - Added conditional build requirement for boost-python to build on rawhide * Wed May 9 2018 spike 2.7.13-1 - Updated to new upstream release 2.7.12 * Fri May 4 2018 spike 2.7.12-2 - Building against libtirpc to be compatible with Fedora 28 * Fri Jan 26 2018 spike 2.7.12-1 - Updated to new upstream release 2.7.12 * Fri Sep 1 2017 spike 2.7.11-5 - Added dependencies for python2-tkinter, boost-python and tkimg * Fri Sep 1 2017 spike 2.7.11-4 - Added bwidget dependency * Fri Aug 25 2017 spike 2.7.11-3 - Minor spec file updates * Fri Aug 25 2017 spike 2.7.11-2 - Updated to build on Fedora 26