svn commit: r418465 - in head/cad: . linuxcnc-devel linuxcnc-devel/files

Edward Tomasz Napierala trasz at FreeBSD.org
Wed Jul 13 09:18:51 UTC 2016


Author: trasz
Date: Wed Jul 13 09:18:47 2016
New Revision: 418465
URL: https://svnweb.freebsd.org/changeset/ports/418465

Log:
  LinuxCNC controls CNC machines. It can drive milling machines,
  lathes, 3d printers, laser cutters, plasma cutters, robot arms,
  hexapods, and more.
  
  - Accepts G-code input, drives CNC machines in response.
  - Active user community.
  - Several different GUIs available.
  - Compatible with many popular machine control hardware interfaces.
  - Supports rigid tapping, cutter compensation, and many other advanced
    control features.
  
  WARNING: This port is simulation-only for now.
  
  WWW: http://linuxcnc.org/

Added:
  head/cad/linuxcnc-devel/
  head/cad/linuxcnc-devel/Makefile   (contents, props changed)
  head/cad/linuxcnc-devel/distinfo   (contents, props changed)
  head/cad/linuxcnc-devel/files/
  head/cad/linuxcnc-devel/files/patch-scripts_hal-histogram   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-scripts_latency-histogram   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-scripts_latency-plot   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-scripts_realtime.in   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-scripts_sim__pin   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_Makefile   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_Makefile.inc.in   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_configure.in   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_hal_components_Submakefile   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__gm.c   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__parport.c   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__ppmc.c   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_hal_hal__lib.c   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_hal_utils_halcompile.g   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_libnml_buffer_recvn.c   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_po_git-merge-po   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__io.h   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__math.h   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__parport.h   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__uspace.hh   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__common.h   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__rtapi__app.cc   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__rtapi__parport.cc   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-tcl_ngcgui.tcl   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-tcl_tooledit.tcl   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-tests_build_header-sanity_test.sh   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-tests_build_ui_test.sh   (contents, props changed)
  head/cad/linuxcnc-devel/files/patch-tests_lowlevel_mutex_test.sh   (contents, props changed)
  head/cad/linuxcnc-devel/pkg-descr   (contents, props changed)
  head/cad/linuxcnc-devel/pkg-plist   (contents, props changed)
Modified:
  head/cad/Makefile

Modified: head/cad/Makefile
==============================================================================
--- head/cad/Makefile	Wed Jul 13 09:00:12 2016	(r418464)
+++ head/cad/Makefile	Wed Jul 13 09:18:47 2016	(r418465)
@@ -49,6 +49,7 @@
     SUBDIR += leocad
     SUBDIR += librecad
     SUBDIR += linux-eagle5
+    SUBDIR += linuxcnc-devel
     SUBDIR += logisim
     SUBDIR += magic
     SUBDIR += meshdev

Added: head/cad/linuxcnc-devel/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/Makefile	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,54 @@
+# Created by: Edward Tomasz Napierala <trasz at FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME=	linuxcnc-devel
+PORTVERSION=	20160626
+CATEGORIES=	cad
+
+MAINTAINER=	trasz at FreeBSD.org
+COMMENT=	Open Source CNC machine controller
+
+LICENSE=	GPLv2
+
+LIB_DEPENDS=	libBLT25.so:x11-toolkits/blt \
+		libboost_python.so:devel/boost-python-libs \
+		libfontconfig.so:x11-fonts/fontconfig \
+		libfreetype.so:print/freetype2 \
+		libmodbus.so:comms/libmodbus \
+		libncurses.so:devel/ncurses \
+		libXaw.so:x11-toolkits/libXaw \
+		libtclx8.4.so:lang/tclX
+RUN_DEPENDS=	bash:shells/bash \
+		bwidget>=1.4:x11-toolkits/bwidget \
+		${PYTHON_SITELIBDIR}/gtk-2.0/vtemodule.so:x11-toolkits/py-vte \
+		${PYTHON_SITELIBDIR}/gtk-2.0/gtk/gdkgl/__init__.py:x11-toolkits/py-gtkglext \
+		${LOCALBASE}/lib/Img/libtkimg1.4.6.so:graphics/libimg
+BUILD_DEPENDS=	${RUN_DEPENDS}
+
+BROKEN_FreeBSD_9=	requires libusb
+NO_PACKAGE=	Licensing conflict between LinuxCNC (GPL2) and readline (GPL3)
+
+WRKSRC=		${WRKDIR}/linuxcnc-${GH_TAGNAME}/src
+PATCH_WRKSRC=	${WRKDIR}/linuxcnc-${GH_TAGNAME}
+ALL_TARGET=	default
+
+GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--with-realtime=uspace --enable-non-distributable=yes CFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" CXXFLAGS="-I${LOCALBASE}/include" CXX=c++ CC=cc --with-locale-dir="${PREFIX}/share/locale"
+MAKE_ENV=	BUILD_VERBOSE=1
+USES=		autoreconf gettext gmake ncurses pkgconfig python readline shebangfix tk
+USE_GL=		gl glu
+USE_GNOME=	cairo gdkpixbuf2 pygtksourceview
+USE_XORG=	ice sm x11 xext xft xinerama xmu xrender xscrnsaver xt
+USE_LDCONFIG=	yes
+USE_GITHUB=	yes
+GH_ACCOUNT=	LinuxCNC
+GH_PROJECT=	linuxcnc
+GH_TAGNAME=	fe7b155c03fe77d6eb301bcfdc3d7c1acdea73e4
+
+post-patch:
+		${FIND} ${PATCH_WRKSRC} -type f | ${XARGS} ${REINPLACE_CMD} \
+			-e 's|#!.*/bin/bash|#!${LOCALBASE}/bin/bash|' \
+			-e 's|#!.*/usr/bin/tclsh|#!${LOCALBASE}/bin/tclsh8.6|' \
+			-e 's|#!.*/usr/bin/wish|#!${LOCALBASE}/bin/wish8.6|'
+
+.include <bsd.port.mk>

Added: head/cad/linuxcnc-devel/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/distinfo	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1466926499
+SHA256 (LinuxCNC-linuxcnc-20160626-fe7b155c03fe77d6eb301bcfdc3d7c1acdea73e4_GH0.tar.gz) = f48c622e54c269569471dd89dcf888795e8e80b4cddb16040951a46f6b679c72
+SIZE (LinuxCNC-linuxcnc-20160626-fe7b155c03fe77d6eb301bcfdc3d7c1acdea73e4_GH0.tar.gz) = 24689564

Added: head/cad/linuxcnc-devel/files/patch-scripts_hal-histogram
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-scripts_hal-histogram	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,8 @@
+--- scripts/hal-histogram.orig	2016-06-25 02:19:12 UTC
++++ scripts/hal-histogram
+@@ -1,4 +1,4 @@
+-#!/usr/bin/wish
++#!/usr/bin/env wish8.6
+ 
+ # For usage: hal-histogram --help
+ 

Added: head/cad/linuxcnc-devel/files/patch-scripts_latency-histogram
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-scripts_latency-histogram	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,90 @@
+--- scripts/latency-histogram.orig	2016-06-25 02:19:12 UTC
++++ scripts/latency-histogram
+@@ -1,4 +1,4 @@
+-#!/usr/bin/wish
++#!/usr/bin/env wish8.6
+ #
+ 
+ # Usage:
+@@ -51,7 +51,7 @@ package require Tclx
+ proc set_defaults {} {
+   set ::LH(start) [clock seconds]
+   # don't include glxgears, error suffices
+-  program_check {halrun halcmd lsmod pgrep pkill hostname}
++  program_check {halrun halcmd pgrep pkill hostname}
+   if {[string first rtai [string tolower $::tcl_platform(osVersion)]] >=0} {
+     set ::LH(rtai) rtai
+     set ::LH(realtime) [exec linuxcnc_var REALTIME]
+@@ -234,25 +234,25 @@ $display \
+ } ;# other_info
+ 
+ proc processor_info {} {
+-  set cmdline [exec cat /proc/cmdline]
+-  set idx [string first isolcpus $cmdline]
+-  if {$idx < 0} {
++#  set cmdline [exec cat /proc/cmdline]
++#  set idx [string first isolcpus $cmdline]
++#  if {$idx < 0} {
+     set isolcpus no_isolcpus
+-  } else {
+-    set tmp [string range $cmdline $idx end]
+-    set tmp "$tmp " ;# add trailing blank
+-    set isolcpus [string range $tmp 0 [expr -1 + [string first " " $tmp]]]
+-  }
+-  set fd [open /proc/cpuinfo]
+-  while {![eof $fd]} {
+-    gets $fd newline
+-    set s [split $newline :]
+-    set key [string trim [lindex $s 0]]
+-    set key [string map "\" \" _" $key]
+-    set v [lindex $s 1]
+-    set procinfo($key) $v
+-  }
+-  close $fd
++#  } else {
++#    set tmp [string range $cmdline $idx end]
++#    set tmp "$tmp " ;# add trailing blank
++#    set isolcpus [string range $tmp 0 [expr -1 + [string first " " $tmp]]]
++#  }
++#  set fd [open /proc/cpuinfo]
++#  while {![eof $fd]} {
++#    gets $fd newline
++#    set s [split $newline :]
++#    set key [string trim [lindex $s 0]]
++#    set key [string map "\" \" _" $key]
++#    set v [lindex $s 1]
++#    set procinfo($key) $v
++#  }
++#  close $fd
+ 
+   set cores "1_core"
+   catch {set cores "$procinfo(cpu_cores) cores"};# item may not exist
+@@ -297,17 +297,17 @@ proc load_packages {} {
+     exit 1
+   }
+ 
+-  if [info exists ::LH(rtai)] {
+-    if [catch {exec lsmod | grep rtai} msg] {
+-      # puts ok_to_start_rtai
+-    } else {
+-      popup "RTAI is already running, (try: \$ halrun -U)"
+-      exit 1
+-    }
+-    exec $::LH(realtime) start &
+-    progress "Delay for realtime startup"
+-    after 1000 ;# wait to load Hal package
+-  }
++#  if [info exists ::LH(rtai)] {
++#    if [catch {exec | grep rtai} msg] {
++#      # puts ok_to_start_rtai
++#    } else {
++#      popup "RTAI is already running, (try: \$ halrun -U)"
++#      exit 1
++#    }
++#    exec $::LH(realtime) start &
++#    progress "Delay for realtime startup"
++#    after 1000 ;# wait to load Hal package
++#  }
+ 
+   # augment ::auto_path for special case:
+   # 1) RIP build (no install)

Added: head/cad/linuxcnc-devel/files/patch-scripts_latency-plot
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-scripts_latency-plot	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,54 @@
+--- scripts/latency-plot.orig	2016-06-25 02:19:12 UTC
++++ scripts/latency-plot
+@@ -1,4 +1,4 @@
+-#!/usr/bin/wish
++#!/usr/bin/env wish8.6
+ 
+ # Notes:
+ # notusing y axis title because it coredumps with X BadMatch with wish8.5
+@@ -161,15 +161,15 @@ proc init_hal_timedelta {} {
+ } ;# init_hal_timedelta
+ 
+ proc check {} {
+-  if {[string first rtai [exec lsmod]] < 0} {
+-    #puts "ok -- no rtai modules currently loaded"
+-  } else {
+-    set msg "Cannot start with rtai modules loaded.\
+-Stop all programs (linuxcnc) using realtime first and then run:\n\n\
+-halrun -U\n"
+-    popup $msg
+-    exit 1
+-  }
++#  if {[string first rtai [exec lsmod]] < 0} {
++#    #puts "ok -- no rtai modules currently loaded"
++#  } else {
++#    set msg "Cannot start with rtai modules loaded.\
++#Stop all programs (linuxcnc) using realtime first and then run:\n\n\
++#halrun -U\n"
++#    popup $msg
++#    exit 1
++#  }
+   switch $::sc(data,source) {
+     hal_timedelta  {}
+     default {return -code error "init: unknown data,source: <$::sc(data,source)>"}
+@@ -179,13 +179,13 @@ halrun -U\n"
+ proc mcheck {} {
+   # cautionary check on memory usage
+   # %mem "ratio of process's resident set size to the physical mem in percent"
+-  set mempercent [eval exec ps --no-headers --pid $::sc(pid) -o %mem]
+-  if {$mempercent > $::sc(mem,max,percent)} {
+-    set msg "Memory used is ${mempercent}%, Exiting"
+-    popup $msg
+-    exit 1
+-  }
+-  after 10000 mcheck
++#  set mempercent [eval exec ps --no-headers --pid $::sc(pid) -o %mem]
++#  if {$mempercent > $::sc(mem,max,percent)} {
++#    set msg "Memory used is ${mempercent}%, Exiting"
++#    popup $msg
++#    exit 1
++#  }
++#  after 10000 mcheck
+ } ;# mcheck
+ 
+ proc start {} {

Added: head/cad/linuxcnc-devel/files/patch-scripts_realtime.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-scripts_realtime.in	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,38 @@
+--- scripts/realtime.in.orig	2016-06-25 02:19:12 UTC
++++ scripts/realtime.in
+@@ -6,7 +6,7 @@
+ 
+ export LANG=C
+ 
+-PIDOF=@PIDOF@
++HALCMD="halcmd"
+ 
+ CheckKernel() {
+     case "@KERNEL_VERS@" in
+@@ -104,7 +104,7 @@ CheckConfig(){
+ CheckStatus(){
+     case $RTPREFIX in
+     uspace)
+-        if [ -z "$($PIDOF rtapi_app)" ]; then
++        if [ `$HALCMD -s show comp | wc -l` -eq 2 ]; then
+             exit 1
+         else
+             exit 0
+@@ -187,15 +187,14 @@ Unload(){
+         # wait 5 seconds for rtapi_app to die and be reaped by its parent
+         START=$SECONDS
+         while [ 5 -gt $((SECONDS-START)) ]; do
+-            if ! ps -C rtapi_app > /dev/null 2> /dev/null; then
++            if [ `$HALCMD -s show comp | wc -l` -eq 2 ]; then
+                 break
+             fi
+             sleep 0.1
+         done
+-        if ps -C rtapi_app > /dev/null 2> /dev/null; then
++        if [ `$HALCMD -s show comp | wc -l` -ne 2 ]; then
+             echo "ERROR: rtapi_app failed to die" 1>&2
+         fi
+-
+         ipcrm -M 0x48414c32 2>/dev/null ;# HAL_KEY
+         ipcrm -M 0x90280A48 2>/dev/null ;# RTAPI_KEY
+         ipcrm -M 0x48484c34 2>/dev/null ;# UUID_KEY

Added: head/cad/linuxcnc-devel/files/patch-scripts_sim__pin
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-scripts_sim__pin	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,8 @@
+--- scripts/sim_pin.orig	2016-06-25 02:19:12 UTC
++++ scripts/sim_pin
+@@ -1,4 +1,4 @@
+-#!/usr/bin/wish
++#!/usr/bin/env wish8.6
+ 
+ if [catch {package require Hal} msg] {
+   puts "\nProblem: $msg"

Added: head/cad/linuxcnc-devel/files/patch-src_Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_Makefile	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,145 @@
+--- src/Makefile.orig	2016-06-25 02:19:12 UTC
++++ src/Makefile
+@@ -183,7 +183,7 @@ $(shell $(VECHO) 1>&2 Done reading depen
+ endif
+ 
+ # Each directory in $(INCLUDES) is passed as a -I directory when compiling.
+-INCLUDE := $(patsubst %,-I%, $(INCLUDES)) -I$(RTDIR)/include
++INCLUDE := $(patsubst %,-I%, $(INCLUDES)) -I$(RTDIR)/include -I/usr/local/include
+ INCLUDE += -I$(INCLUDEPY)
+ 
+ # Compilation options.	Perhaps some of these should come from Makefile.inc? (CXXFLAGS now does)
+@@ -193,10 +193,12 @@ DEBUG := $(DEBUG) -g -Wall
+ CFLAGS := $(INCLUDE) $(OPT) $(DEBUG) $(EXTRA_DEBUG) -DULAPI -std=gnu99 -fgnu89-inline
+ CXXFLAGS := $(INCLUDE) $(CXXFLAGS)   $(EXTRA_DEBUG) -DULAPI $(DEBUG) $(OPT) -Woverloaded-virtual
+ 
++UNAME_S := $(shell uname -s)
++
+ ifeq ($(RUN_IN_PLACE),yes)
+-LDFLAGS := -L$(LIB_DIR) -Wl,-rpath,$(LIB_DIR)
++LDFLAGS := -L$(LIB_DIR) -Wl,-rpath,$(LIB_DIR) -L/usr/local/lib -lintl
+ else
+-LDFLAGS := -Wl,-rpath-link,../lib
++LDFLAGS := -Wl,-rpath-link,../lib -L/usr/local/lib -lintl
+ endif
+ 
+ # Rules to make .o (object) files
+@@ -498,7 +500,7 @@ $(patsubst %,../include/%,$(wildcard *.h
+ 
+ DIR=install -d -m 0755 -o root
+ FILE=install -m 0644 -o root
+-TREE=cp -dR
++TREE=cp -R
+ CONFIGFILE=install -m 0644
+ EXE=install -m 0755 -o root
+ SETUID=install -m 4755 -o root
+@@ -546,7 +548,7 @@ install-dirs:
+ 		$(DESTDIR)$(sysconfdir)/linuxcnc $(DESTDIR)$(bindir) \
+ 		$(DESTDIR)$(libdir) $(DESTDIR)$(includedir)/linuxcnc \
+ 		$(DESTDIR)$(docsdir) $(DESTDIR)$(ncfilesdir) \
+-		$(DESTDIR)/etc/X11/app-defaults $(DESTDIR)$(tcldir)/bin \
++		$(DESTDIR)$(prefix)/share/X11/app-defaults $(DESTDIR)$(tcldir)/bin \
+ 		$(DESTDIR)$(tcldir)/scripts \
+ 		$(DESTDIR)$(mandir)/man1 \
+ 		$(DESTDIR)$(mandir)/man3 \
+@@ -600,15 +602,14 @@ install-kernel-indep: install-dirs
+ 	$(EXE) ../scripts/gladevcp_demo $(DESTDIR)$(bindir)
+ 	$(EXE) ../scripts/linuxcncmkdesktop $(DESTDIR)$(bindir)
+ 	$(FILE) $(filter ../lib/%.a ../lib/%.so.0,$(TARGETS)) $(DESTDIR)$(libdir)
+-	cp --no-dereference $(filter ../lib/%.so, $(TARGETS)) $(DESTDIR)$(libdir)
+-	-ldconfig $(DESTDIR)$(libdir)
++	cp $(filter ../lib/%.so, $(TARGETS)) $(DESTDIR)$(libdir)
+ 	$(FILE) $(HEADERS) $(DESTDIR)$(includedir)/linuxcnc/
+ 	$(FILE) $(addprefix ../docs/,$(DOCS)) $(DESTDIR)$(docsdir)
+ 	$(FILE) $(DOCS_HELP) $(DESTDIR)$(docsdir)
+ 	$(TREE) $(NC_FILES) $(DESTDIR)$(ncfilesdir)
+ 	$(EXE) ../nc_files/M101 $(DESTDIR)$(ncfilesdir)
+-	$(FILE) ../tcl/TkLinuxCNC $(DESTDIR)/etc/X11/app-defaults
+-	$(FILE) ../app-defaults/XEmc $(DESTDIR)/etc/X11/app-defaults
++	$(FILE) ../tcl/TkLinuxCNC $(DESTDIR)$(prefix)/share/X11/app-defaults
++	$(FILE) ../app-defaults/XEmc $(DESTDIR)$(prefix)/share/X11/app-defaults
+ 	$(FILE) Makefile.modinc $(DESTDIR)$(datadir)/linuxcnc
+ 	$(EXE) $(TCL) $(DESTDIR)$(tcldir)
+ 	$(FILE) ../tcl/hal.so $(DESTDIR)$(tcldir)
+@@ -713,6 +714,7 @@ endif
+ # that's what kbuild seems to require
+ 
+ EXTRA_CFLAGS := $(filter-out -ffast-math,$(RTFLAGS)) -D__MODULE__ -I$(BASEPWD) -I$(BASEPWD)/libnml/linklist \
++	-I/usr/local/include \
+ 	-I$(BASEPWD)/libnml/cms -I$(BASEPWD)/libnml/rcs -I$(BASEPWD)/libnml/inifile \
+ 	-I$(BASEPWD)/libnml/os_intf -I$(BASEPWD)/libnml/nml -I$(BASEPWD)/libnml/buffer \
+ 	-I$(BASEPWD)/libnml/posemath -I$(BASEPWD)/rtapi -I$(BASEPWD)/hal \
+@@ -823,11 +825,11 @@ hal_gm-objs := hal/drivers/hal_gm.o $(MA
+ obj-$(CONFIG_HAL_PPMC) += hal_ppmc.o
+ hal_ppmc-objs := hal/drivers/hal_ppmc.o $(MATHSTUB)
+ 
+-obj-$(CONFIG_HOSTMOT2) += hostmot2.o hm2_test.o hm2_pci.o hm2_7i43.o hm2_7i90.o setsserial.o
+-ifeq ($(BUILD_SYS),uspace)
+-obj-$(CONFIG_HOSTMOT2) += hm2_eth.o hm2_spi.o
+-endif
+-hostmot2-objs :=			  \
++#obj-$(CONFIG_HOSTMOT2) += hostmot2.o hm2_test.o hm2_pci.o hm2_7i43.o hm2_7i90.o setsserial.o
++#ifeq ($(BUILD_SYS),uspace)
++#obj-$(CONFIG_HOSTMOT2) += hm2_eth.o hm2_spi.o
++#endif
++#hostmot2-objs :=			  \
+     hal/drivers/mesa-hostmot2/hostmot2.o  \
+     hal/drivers/mesa-hostmot2/ioport.o	  \
+     hal/drivers/mesa-hostmot2/encoder.o   \
+@@ -848,29 +850,29 @@ hostmot2-objs :=			  \
+     hal/drivers/mesa-hostmot2/raw.o	  \
+     hal/drivers/mesa-hostmot2/bitfile.o   \
+     $(MATHSTUB)
+-hm2_7i90-objs :=			  \
++#hm2_7i90-objs :=			  \
+     hal/drivers/mesa-hostmot2/hm2_7i90.o  \
+     hal/drivers/mesa-hostmot2/bitfile.o   \
+     $(MATHSTUB)
+-hm2_7i43-objs :=			  \
++#hm2_7i43-objs :=			  \
+     hal/drivers/mesa-hostmot2/hm2_7i43.o  \
+     hal/drivers/mesa-hostmot2/bitfile.o   \
+     $(MATHSTUB)
+-hm2_pci-objs  :=			  \
++#hm2_pci-objs  :=			  \
+     hal/drivers/mesa-hostmot2/hm2_pci.o   \
+     hal/drivers/mesa-hostmot2/bitfile.o   \
+     $(MATHSTUB)
+-hm2_eth-objs  :=			  \
++#hm2_eth-objs  :=			  \
+     hal/drivers/mesa-hostmot2/hm2_eth.o   \
+     $(MATHSTUB)
+-hm2_spi-objs  :=			  \
++#hm2_spi-objs  :=			  \
+     hal/drivers/mesa-hostmot2/hm2_spi.o   \
+     $(MATHSTUB)
+-hm2_test-objs :=			  \
++#hm2_test-objs :=			  \
+     hal/drivers/mesa-hostmot2/hm2_test.o  \
+     hal/drivers/mesa-hostmot2/bitfile.o   \
+     $(MATHSTUB)
+-setsserial-objs :=			  \
++#setsserial-objs :=			  \
+     hal/drivers/mesa-hostmot2/setsserial.o  \
+     $(MATHSTUB)
+ 
+@@ -1045,13 +1047,13 @@ endif
+ ../rtlib/pumakins$(MODULE_EXT): $(addprefix objects/rt,$(pumakins-objs))
+ ../rtlib/scarakins$(MODULE_EXT): $(addprefix objects/rt,$(scarakins-objs))
+ ../rtlib/hal_gm$(MODULE_EXT): $(addprefix objects/rt,$(hal_gm-objs))
+-../rtlib/hostmot2$(MODULE_EXT): $(addprefix objects/rt,$(hostmot2-objs))
+-../rtlib/hm2_test$(MODULE_EXT): $(addprefix objects/rt,$(hm2_test-objs))
+-../rtlib/hm2_pci$(MODULE_EXT): $(addprefix objects/rt,$(hm2_pci-objs))
+-../rtlib/hm2_7i43$(MODULE_EXT): $(addprefix objects/rt,$(hm2_7i43-objs))
+-../rtlib/hm2_7i90$(MODULE_EXT): $(addprefix objects/rt,$(hm2_7i90-objs))
++#../rtlib/hostmot2$(MODULE_EXT): $(addprefix objects/rt,$(hostmot2-objs))
++#../rtlib/hm2_test$(MODULE_EXT): $(addprefix objects/rt,$(hm2_test-objs))
++#../rtlib/hm2_pci$(MODULE_EXT): $(addprefix objects/rt,$(hm2_pci-objs))
++#../rtlib/hm2_7i43$(MODULE_EXT): $(addprefix objects/rt,$(hm2_7i43-objs))
++#../rtlib/hm2_7i90$(MODULE_EXT): $(addprefix objects/rt,$(hm2_7i90-objs))
+ ../rtlib/setsserial$(MODULE_EXT): $(addprefix objects/rt,$(setsserial-objs))
+-../rtlib/hal_parport$(MODULE_EXT): $(addprefix objects/rt,$(hal_parport-objs))
++#../rtlib/hal_parport$(MODULE_EXT): $(addprefix objects/rt,$(hal_parport-objs))
+ ../rtlib/hal_ppmc$(MODULE_EXT): $(addprefix objects/rt,$(hal_ppmc-objs))
+ ../rtlib/hm2_eth$(MODULE_EXT): $(addprefix objects/rt,$(hm2_eth-objs))
+ ../rtlib/hm2_spi$(MODULE_EXT): $(addprefix objects/rt,$(hm2_spi-objs))

Added: head/cad/linuxcnc-devel/files/patch-src_Makefile.inc.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_Makefile.inc.in	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,11 @@
+--- src/Makefile.inc.in.orig	2016-06-25 02:19:12 UTC
++++ src/Makefile.inc.in
+@@ -62,7 +62,7 @@ LANGUAGES = @LANGUAGES@
+ 
+ #still needs discussion
+ # do we really need these?
+-initd_dir = /etc/init.d
++initd_dir = ${prefix}/etc/rc.d
+ docsdir = ${prefix}/share/doc/linuxcnc
+ sampleconfsdir = ${prefix}/share/doc/linuxcnc/examples/sample-configs
+ ncfilesdir = ${prefix}/share/linuxcnc/ncfiles

Added: head/cad/linuxcnc-devel/files/patch-src_configure.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_configure.in	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,49 @@
+--- src/configure.in.orig	2016-06-25 02:19:12 UTC
++++ src/configure.in
+@@ -665,7 +665,7 @@ else
+     esac
+     LINUXCNC_CONFIG_PATH="~/linuxcnc/configs:/usr/local/etc/linuxcnc/configs:"$(eval echo $EMC2_HELP_DIR)"/examples/sample-configs"
+     EMC2_NCFILES_DIR=${prefix}/share/linuxcnc/ncfiles
+-    REALTIME=/etc/init.d/realtime
++    REALTIME=${prefix}/etc/rc.d/realtime
+     EMC2_IMAGE_DIR=$(fe "$datadir")/linuxcnc
+     HALLIB_DIR=${prefix}/share/linuxcnc/hallib
+ fi
+@@ -807,25 +807,25 @@ then
+     AC_MSG_ERROR([awk not found])
+ fi
+ 
+-AC_PATH_PROG(INSMOD, insmod, "none", $SPATH)
++AC_PATH_PROG(INSMOD, false, "none", $SPATH)
+ if test $INSMOD = "none"
+ then
+     AC_MSG_ERROR([insmod not found])
+ fi
+ 
+-AC_PATH_PROG(RMMOD, rmmod, "none", $SPATH)
++AC_PATH_PROG(RMMOD, false, "none", $SPATH)
+ if test $RMMOD = "none"
+ then
+     AC_MSG_ERROR([rmmod not found])
+ fi
+ 
+-AC_PATH_PROG(LSMOD, lsmod, "none", $SPATH)
++AC_PATH_PROG(LSMOD, true, "none", $SPATH)
+ if test $LSMOD = "none"
+ then
+     AC_MSG_ERROR([lsmod not found])
+ fi
+ 
+-AC_PATH_PROG(PIDOF, pidof, "none", $SPATH)
++AC_PATH_PROGS(PIDOF, pidof pgrep, "none", $SPATH)
+ if test $PIDOF = "none"
+ then
+     AC_MSG_ERROR([pidof not found])
+@@ -1180,7 +1180,6 @@ AC_MSG_RESULT($HAVE_OPTRESET)
+ AC_SUBST([HAVE_OPTRESET])
+ 
+ 
+-
+ LIBS_hold=$LIBS
+ LIBS=
+ AC_SEARCH_LIBS(dlopen, [c dl], [

Added: head/cad/linuxcnc-devel/files/patch-src_hal_components_Submakefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_hal_components_Submakefile	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,11 @@
+--- src/hal/components/Submakefile.orig	2016-06-25 02:19:12 UTC
++++ src/hal/components/Submakefile
+@@ -76,7 +76,7 @@ PYFLAGS := -L$(SITEPY) -lpthread $(LIBDL
+ 
+ ../bin/panelui: $(call TOOBJS, $(PYSAMPLERSRCS)) ../lib/liblinuxcnchal.so.0
+ 	$(ECHO) Linking $(notdir $@)
+-	$(Q)$(CC) -o $@ $^ $(PYFLAGS)
++	$(Q)$(CC) -o $@ $^ $(LDFLAGS) $(CFLAGS) $(PYFLAGS)
+ TARGETS += ../bin/panelui
+ 
+ hal/components/conv_float_s32.comp: hal/components/conv.comp.in hal/components/mkconv.sh hal/components/Submakefile

Added: head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__gm.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__gm.c	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,13 @@
+--- src/hal/drivers/hal_gm.c.orig	2016-06-25 02:19:12 UTC
++++ src/hal/drivers/hal_gm.c
+@@ -1791,6 +1791,10 @@ stepgenControl(void *arg, long period, u
+ 	  }
+   
+ 	}
++
++	else {
++		ref_vel = 90210; // XXX: 42 perhaps?
++	}
+       //Check max velocity, max acceleration and output baudrate
+       
+ 	//Check max velocity

Added: head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__parport.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__parport.c	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,23 @@
+--- src/hal/drivers/hal_parport.c.orig	2016-06-25 02:19:12 UTC
++++ src/hal/drivers/hal_parport.c
+@@ -116,6 +116,8 @@ MODULE_LICENSE("GPL");
+ static char *cfg = "0x0278";	/* config string, default 1 output port at 278 */
+ RTAPI_MP_STRING(cfg, "config string");
+ 
++#ifdef __linux__
++
+ /***********************************************************************
+ *                STRUCTURES AND GLOBAL VARIABLES                       *
+ ************************************************************************/
+@@ -743,3 +745,11 @@ static int export_output_pin(int portnum
+ 		"parport.%d.pin-%02d-out-reset", portnum, pin);
+     return retval;
+ }
++#else
++int rtapi_app_main(void)
++{
++	rtapi_print_msg(RTAPI_MSG_ERR, "PARPORT: !linux\n");
++	return -1;
++}
++
++#endif /* !__linux__ */

Added: head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__ppmc.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_hal_drivers_hal__ppmc.c	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,17 @@
+--- src/hal/drivers/hal_ppmc.c.orig	2016-06-25 02:19:12 UTC
++++ src/hal/drivers/hal_ppmc.c
+@@ -81,6 +81,9 @@
+ MODULE_AUTHOR("John Kasunich");
+ MODULE_DESCRIPTION("HAL driver for Universal PWM Controller");
+ MODULE_LICENSE("GPL");
++
++#ifdef __linux__
++
+ int port_addr[MAX_BUS] = { 0x378, [1 ... MAX_BUS-1] = -1 };
+     /* default, 1 bus at 0x0378 */
+ hal_parport_t port_registration[MAX_BUS];
+@@ -2428,3 +2431,4 @@ static void WrtMore(unsigned char byte, 
+     return;
+ }
+ 
++#endif

Added: head/cad/linuxcnc-devel/files/patch-src_hal_hal__lib.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_hal_hal__lib.c	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,10 @@
+--- src/hal/hal_lib.c.orig	2016-06-25 02:19:12 UTC
++++ src/hal/hal_lib.c
+@@ -2698,6 +2698,7 @@ void rtapi_app_exit(void)
+ 	/* and delete it */
+ 	free_thread_struct(thread);
+     }
++    hal_data->base_period = 0;
+     /* release mutex */
+     rtapi_mutex_give(&(hal_data->mutex));
+     /* release RTAPI resources */

Added: head/cad/linuxcnc-devel/files/patch-src_hal_utils_halcompile.g
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_hal_utils_halcompile.g	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,20 @@
+--- src/hal/utils/halcompile.g.orig	2016-06-25 02:19:12 UTC
++++ src/hal/utils/halcompile.g
+@@ -709,7 +709,7 @@ def build_usr(tempdir, filename, mode, o
+         options.get("extra_link_args", ""))
+     print >>f, "include %s" % find_modinc()
+     f.close()
+-    result = os.system("cd %s && make -S %s" % (tempdir, binname))
++    result = os.system("cd %s && gmake -S %s" % (tempdir, binname))
+     if result != 0:
+         raise SystemExit, os.WEXITSTATUS(result) or 1
+     output = os.path.join(tempdir, binname)
+@@ -731,7 +731,7 @@ def build_rt(tempdir, filename, mode, or
+         target = "modules install"
+     else:
+         target = "modules"
+-    result = os.system("cd %s && make -S %s" % (tempdir, target))
++    result = os.system("cd %s && gmake -S %s" % (tempdir, target))
+     if result != 0:
+         raise SystemExit, os.WEXITSTATUS(result) or 1
+     if mode == COMPILE:

Added: head/cad/linuxcnc-devel/files/patch-src_libnml_buffer_recvn.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_libnml_buffer_recvn.c	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,11 @@
+--- src/libnml/buffer/recvn.c.orig	2016-06-25 02:19:12 UTC
++++ src/libnml/buffer/recvn.c
+@@ -186,7 +186,7 @@ int recvn(int fd, void *vptr, int n, int
+ 		}
+ 		nrecv = 0;
+ 	    } else if (nrecv == 0) {
+-		rcs_print_error("recvn: Premature EOF recieved.\n");
++		rcs_print_error("recvn: Premature EOF received, errno %d, bytes to read %d, flags %x.\n", errno, bytes_to_read, flags);
+ 		return (-2);
+ 	    }
+ 	}

Added: head/cad/linuxcnc-devel/files/patch-src_po_git-merge-po
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_po_git-merge-po	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,8 @@
+--- src/po/git-merge-po.orig	2016-06-25 02:19:12 UTC
++++ src/po/git-merge-po
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/local/bin/bash
+ #
+ # Custom Git merge driver - merges PO files using msgcat(1)
+ #

Added: head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__io.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__io.h	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,25 @@
+--- src/rtapi/rtapi_io.h.orig	2016-06-25 02:19:12 UTC
++++ src/rtapi/rtapi_io.h
+@@ -18,13 +18,14 @@
+ 
+ #include <rtapi.h>
+ 
++#ifdef __linux__
+ #ifdef __KERNEL__
+ #include <asm/io.h>
+ #elif defined(__i386) || defined(__x86_64)
+ #include <sys/io.h>
+ #endif
+ 
+-#if defined(__i386) || defined(__x86_64)
++#if (defined(__i386) || defined(__x86_64))
+ #define rtapi_inb inb
+ #define rtapi_inw inw
+ #define rtapi_inl inl
+@@ -40,5 +41,6 @@
+ #define rtapi_outw(x,y) ((void)0)
+ #define rtapi_outl(x,y) ((void)0)
+ #endif
++#endif /* !__linux__ */
+ 
+ #endif

Added: head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__math.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__math.h	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,13 @@
+--- src/rtapi/rtapi_math.h.orig	2016-06-25 02:19:12 UTC
++++ src/rtapi/rtapi_math.h
+@@ -79,7 +79,10 @@ extern __inline double fmin(double __y, 
+ #endif
+ 
+ #else
++#pragma push_macro("value")
++#undef value
+ #include <math.h>
++#pragma pop_macro("value")
+ #endif
+ 
+ #include "rtapi_byteorder.h"

Added: head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__parport.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__parport.h	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,16 @@
+--- src/rtapi/rtapi_parport.h.orig	2016-06-25 02:19:12 UTC
++++ src/rtapi/rtapi_parport.h
+@@ -16,6 +16,8 @@
+ #ifndef RTAPI_PARPORT_H
+ #define RTAPI_PARPORT_H
+ 
++#ifdef __linux__
++
+ #include <rtapi.h>
+ #include <rtapi_io.h>
+ #include <linux/parport.h>
+@@ -239,3 +241,4 @@ void rtapi_parport_release(rtapi_parport
+ RTAPI_END_DECLS
+ 
+ #endif
++#endif /* __linux__ */

Added: head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__uspace.hh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_rtapi_rtapi__uspace.hh	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,24 @@
+--- src/rtapi/rtapi_uspace.hh.orig	2016-06-25 02:19:12 UTC
++++ src/rtapi/rtapi_uspace.hh
+@@ -17,14 +17,21 @@
+  */
+ #ifndef RTAPI_USPACE_HH
+ #define RTAPI_USPACE_HH
++#ifdef __linux__
+ #include <sys/fsuid.h>
++#endif
+ #include <unistd.h>
+ #include <pthread.h>
+ 
+ struct WithRoot
+ {
++#ifdef __linux__
+     WithRoot() { if(!level) setfsuid(geteuid()); level++; }
+     ~WithRoot() { --level; if(!level) setfsuid(getuid()); }
++#else
++    WithRoot() { if(!level) level++; }
++    ~WithRoot() { --level; if(!level) seteuid(getuid()); }
++#endif
+     static int level;
+ };
+ 

Added: head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__common.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__common.h	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,45 @@
+--- src/rtapi/uspace_common.h.orig	2016-06-25 02:19:12 UTC
++++ src/rtapi/uspace_common.h
+@@ -85,6 +85,7 @@ int rtapi_shmem_new(int key, int module_
+     if(res < 0) perror("shmctl IPC_SET");
+   }
+ 
++#ifdef __linux__
+ #ifdef RTAPI
+   if(rtapi_is_realtime())
+   {
+@@ -99,6 +100,7 @@ int rtapi_shmem_new(int key, int module_
+           "shared memory segment not locked as requested\n");
+   }
+ #endif
++#endif
+ 
+   /* and map it into process space */
+   shmem->mem = shmat(shmem->id, 0, 0);
+@@ -261,7 +263,7 @@ long long rtapi_get_time(void) {
+     return ts.tv_sec * 1000000000LL + ts.tv_nsec;
+ }
+ 
+-#if defined(__i386) || defined(__amd64)
++#if defined(__linux__) && (defined(__i386) || defined(__amd64))
+ #define rdtscll(val) ((val) = __builtin_ia32_rdtsc())
+ #else
+ #define rdtscll(val) ((val) = rtapi_get_time())
+@@ -327,6 +329,7 @@ int rtapi_exit(int module_id)
+ int rtapi_is_kernelspace() { return 0; }
+ static int _rtapi_is_realtime = -1;
+ static int detect_realtime() {
++#ifdef __linux__
+     struct utsname u;
+     int crit1, crit2 = 0, crit3 = 0;
+     FILE *fd;
+@@ -346,6 +349,9 @@ static int detect_realtime() {
+         crit3 = 1;
+ 
+     return crit1 && crit2 && crit3;
++#else
++    return 0;
++#endif
+ }
+ 
+ int rtapi_is_realtime() {

Added: head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__rtapi__app.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__rtapi__app.cc	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,125 @@
+--- src/rtapi/uspace_rtapi_app.cc.orig	2016-06-25 02:19:12 UTC
++++ src/rtapi/uspace_rtapi_app.cc
+@@ -17,7 +17,9 @@
+ 
+ #include "config.h"
+ 
++#ifdef __linux__
+ #include <sys/fsuid.h>
++#endif
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/un.h>
+@@ -42,8 +44,13 @@
+ #endif
+ #include <sys/resource.h>
+ #include <sys/mman.h>
+-#include <malloc.h>
++#ifdef __linux__
+ #include <sys/prctl.h>
++#endif
++#ifdef __FreeBSD__
++#include <pthread_np.h>
++#endif
++
+ 
+ #include "config.h"
+ 
+@@ -56,6 +63,10 @@
+ #include <sys/shm.h>		/* shmget() */
+ #include <string.h>
+ 
++#ifndef __linux__
++#define cpu_set_t cpuset_t
++#endif
++
+ static int rtapi_clock_nanosleep(clockid_t clock_id, int flags,
+         const struct timespec *prequest, struct timespec *remain,
+         const struct timespec *pnow);
+@@ -462,7 +473,11 @@ int main(int argc, char **argv) {
+             "Running with fallback_uid.  getuid()=%d geteuid()=%d\n",
+             getuid(), geteuid());
+     }
++#ifdef __linux__
+     setfsuid(getuid());
++#else
++    seteuid(getuid());
++#endif
+     vector<string> args;
+     for(int i=1; i<argc; i++) { args.push_back(string(argv[i])); }
+ 
+@@ -589,6 +604,7 @@ static void configure_memory()
+     res = mlockall(MCL_CURRENT | MCL_FUTURE);
+     if(res < 0) perror("mlockall");
+ 
++#ifdef __linux__
+     /* Turn off malloc trimming.*/
+     if (!mallopt(M_TRIM_THRESHOLD, -1)) {
+         rtapi_print_msg(RTAPI_MSG_WARN,
+@@ -599,6 +615,7 @@ static void configure_memory()
+         rtapi_print_msg(RTAPI_MSG_WARN,
+                   "mallopt(M_MMAP_MAX, -1) failed\n");
+     }
++#endif
+     char *buf = static_cast<char *>(malloc(PRE_ALLOC_SIZE));
+     if (buf == NULL) {
+         rtapi_print_msg(RTAPI_MSG_WARN, "malloc(PRE_ALLOC_SIZE) failed\n");
+@@ -617,9 +634,12 @@ static void configure_memory()
+ 
+ static int harden_rt()
+ {
++    struct sigaction sig_act = {};
++
+     if(!rtapi_is_realtime()) return -EINVAL;
+ 
+     WITH_ROOT;
++#ifdef __linux__
+ #if defined(__x86_64__) || defined(__i386__)
+     if (iopl(3) < 0) {
+         rtapi_print_msg(RTAPI_MSG_ERR,
+@@ -629,7 +649,6 @@ static int harden_rt()
+     }
+ #endif
+ 
+-    struct sigaction sig_act = {};
+     // enable realtime
+     if (setrlimit(RLIMIT_RTPRIO, &unlimited) < 0)
+     {
+@@ -638,18 +657,20 @@ static int harden_rt()
+ 		  strerror(errno));
+         return -errno;
+     }
++#endif /* __linux__ */
+ 
+     // enable core dumps
+     if (setrlimit(RLIMIT_CORE, &unlimited) < 0)
+ 	rtapi_print_msg(RTAPI_MSG_WARN,
+ 		  "setrlimit: %s - core dumps may be truncated or non-existant\n",
+ 		  strerror(errno));
+-
++#ifdef __linux__
+     // even when setuid root
+     if (prctl(PR_SET_DUMPABLE, 1) < 0)
+ 	rtapi_print_msg(RTAPI_MSG_WARN,
+ 		  "prctl(PR_SET_DUMPABLE) failed: no core dumps will be created - %d - %s\n",
+ 		  errno, strerror(errno));
++#endif /* __linux__ */
+ 
+     configure_memory();
+ 
+@@ -669,6 +690,7 @@ static int harden_rt()
+     sigaction(SIGTERM, &sig_act, (struct sigaction *) NULL);
+     sigaction(SIGINT, &sig_act, (struct sigaction *) NULL);
+ 
++#ifdef __linux__
+     int fd = open("/dev/cpu_dma_latency", O_WRONLY | O_CLOEXEC);
+     if (fd < 0) {
+         rtapi_print_msg(RTAPI_MSG_WARN, "failed to open /dev/cpu_dma_latency: %s\n", strerror(errno));
+@@ -682,6 +704,7 @@ static int harden_rt()
+         }
+         // deliberately leak fd until program exit
+     }
++#endif /* __linux__ */
+     return 0;
+ }
+ 

Added: head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__rtapi__parport.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-src_rtapi_uspace__rtapi__parport.cc	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,15 @@
+--- src/rtapi/uspace_rtapi_parport.cc.orig	2016-06-25 02:19:12 UTC
++++ src/rtapi/uspace_rtapi_parport.cc
+@@ -13,6 +13,7 @@
+ //    You should have received a copy of the GNU General Public License
+ //    along with this program; if not, write to the Free Software
+ //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++#ifdef __linux__
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <linux/ppdev.h>
+@@ -120,3 +121,4 @@ void rtapi_parport_release(rtapi_parport
+     close(port->fd);
+     port->fd = -1;
+ }
++#endif /* __linux__ */

Added: head/cad/linuxcnc-devel/files/patch-tcl_ngcgui.tcl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-tcl_ngcgui.tcl	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,8 @@
+--- tcl/ngcgui.tcl.orig	2016-06-25 02:19:12 UTC
++++ tcl/ngcgui.tcl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/wish
++#!/usr/bin/env wish8.6
+ 
+ #-----------------------------------------------------------------------
+ # ngcgui.tcl is a front-end gui that reads one or more single function

Added: head/cad/linuxcnc-devel/files/patch-tcl_tooledit.tcl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-tcl_tooledit.tcl	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,25 @@
+--- tcl/tooledit.tcl.orig	2016-06-25 02:19:12 UTC
++++ tcl/tooledit.tcl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/wish
++#!/usr/bin/env wish8.6
+ #
+ # Copyright: 2009-2012
+ # Author:    Dewey Garrett <dgarrett at panix.com>
+@@ -345,14 +345,14 @@ proc ::tooledit::watch {args} {
+   switch $args {
+     start {
+       set ::te(mtime) $mtime
+-      set ::te(md5sum) [eval exec md5sum $::te(filename)]
++      set ::te(md5sum) [eval exec md5 $::te(filename)]
+     }
+     stop  {return}
+     default {
+       if {$mtime > $::te(mtime)} {
+         set ::te(mtime) $mtime
+         set md5sum $::te(md5sum)
+-        set ::te(md5sum) [eval exec md5sum $::te(filename)]
++        set ::te(md5sum) [eval exec md5 $::te(filename)]
+         # no message if file contents unchanged
+         if {"$md5sum" != "$::te(md5sum)"} {
+           ::tooledit::message changed

Added: head/cad/linuxcnc-devel/files/patch-tests_build_header-sanity_test.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-tests_build_header-sanity_test.sh	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,17 @@
+--- tests/build/header-sanity/test.sh.orig	2016-06-25 02:19:12 UTC
++++ tests/build/header-sanity/test.sh
+@@ -5,12 +5,12 @@ for i in $HEADERS/*.h; do
+     case $i in
+     */rtapi_app.h) continue ;;
+     esac
+-    gcc -DULAPI -I$HEADERS -E -x c $i > /dev/null
++    cc -DULAPI -I$HEADERS -I/usr/local/include -E -x c $i > /dev/null
+ done
+ for i in $HEADERS/*.h $HEADERS/*.hh; do
+     case $i in
+     */rtapi_app.h) continue ;;
+     */interp_internal.hh) continue ;;
+     esac
+-    g++ -DULAPI -I$HEADERS -E -x c++ $i > /dev/null
++    c++ -DULAPI -I$HEADERS -I/usr/local/include -E -x c++ $i > /dev/null
+ done

Added: head/cad/linuxcnc-devel/files/patch-tests_build_ui_test.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-tests_build_ui_test.sh	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,11 @@
+--- tests/build/ui/test.sh.orig	2016-06-25 02:19:12 UTC
++++ tests/build/ui/test.sh
+@@ -1,6 +1,7 @@
+ #!/bin/sh
+ set -x
+-g++ -I $EMC2_HOME/include \
++c++ -I $EMC2_HOME/include \
++    -I /usr/local/include \
+     nml-position-logger.cc \
+     -L $EMC2_HOME/lib -lnml -llinuxcnc \
+     -o /dev/null

Added: head/cad/linuxcnc-devel/files/patch-tests_lowlevel_mutex_test.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/linuxcnc-devel/files/patch-tests_lowlevel_mutex_test.sh	Wed Jul 13 09:18:47 2016	(r418465)
@@ -0,0 +1,9 @@
+--- tests/lowlevel/mutex/test.sh.orig	2016-06-25 02:19:12 UTC
++++ tests/lowlevel/mutex/test.sh
+@@ -1,5 +1,5 @@

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-ports-all mailing list