about summary refs log tree commit diff
path: root/pkgs/applications/misc/octoprint
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-08-13 03:04:10 +0300
committerNikolay Amiantov <ab@fmap.me>2016-08-14 22:37:07 +0300
commit909094a3ce5e33ac3e0efe05e7878e81331e92ea (patch)
treef4c549e93d3d945836c473131c48b7b50d5a5a92 /pkgs/applications/misc/octoprint
parent503eefa412086e2849db0ed652df62d7a9a065ba (diff)
downloadnixlib-909094a3ce5e33ac3e0efe05e7878e81331e92ea.tar
nixlib-909094a3ce5e33ac3e0efe05e7878e81331e92ea.tar.gz
nixlib-909094a3ce5e33ac3e0efe05e7878e81331e92ea.tar.bz2
nixlib-909094a3ce5e33ac3e0efe05e7878e81331e92ea.tar.lz
nixlib-909094a3ce5e33ac3e0efe05e7878e81331e92ea.tar.xz
nixlib-909094a3ce5e33ac3e0efe05e7878e81331e92ea.tar.zst
nixlib-909094a3ce5e33ac3e0efe05e7878e81331e92ea.zip
octoprint-plugins.m3d-fio: 0.32 -> 1.5
Diffstat (limited to 'pkgs/applications/misc/octoprint')
-rw-r--r--pkgs/applications/misc/octoprint/0001-Don-t-use-static-library.patch113
-rw-r--r--pkgs/applications/misc/octoprint/m33-fio-one-library.patch161
-rw-r--r--pkgs/applications/misc/octoprint/plugins.nix129
3 files changed, 228 insertions, 175 deletions
diff --git a/pkgs/applications/misc/octoprint/0001-Don-t-use-static-library.patch b/pkgs/applications/misc/octoprint/0001-Don-t-use-static-library.patch
deleted file mode 100644
index 54116b80a6e8..000000000000
--- a/pkgs/applications/misc/octoprint/0001-Don-t-use-static-library.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 0be3198cccf753226758684955f49a32d8d920c0 Mon Sep 17 00:00:00 2001
-From: Nikolay Amiantov <ab@fmap.me>
-Date: Wed, 17 Feb 2016 14:37:31 +0300
-Subject: [PATCH] Don't use static library
-
----
- octoprint_m3dfio/__init__.py   | 67 +-----------------------------------------
- shared library source/Makefile |  6 ++--
- 2 files changed, 5 insertions(+), 68 deletions(-)
-
-diff --git a/octoprint_m3dfio/__init__.py b/octoprint_m3dfio/__init__.py
-index a2ca533..43f178a 100644
---- a/octoprint_m3dfio/__init__.py
-+++ b/octoprint_m3dfio/__init__.py
-@@ -793,72 +793,7 @@ class M3DFioPlugin(
- 		# Set file locations
- 		self.setFileLocations()
- 		
--		# Check if running on Linux
--		if platform.uname()[0].startswith("Linux") :
--		
--			# Check if running on a Raspberry Pi 1
--			if platform.uname()[4].startswith("armv6l") and self.getCpuHardware() == "BCM2708" :
--			
--				# Set shared library
--				self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm1176jzf-s.so")
--			
--			# Otherwise check if running on a Raspberry Pi 2 or Raspberry Pi 3
--			elif platform.uname()[4].startswith("armv7l") and self.getCpuHardware() == "BCM2709" :
--			
--				# Set shared library
--				self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm_cortex-a7.so")
--			
--			# Otherwise check if running on an ARM7 device
--			elif platform.uname()[4].startswith("armv7") :
--			
--				# Set shared library
--				self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm7.so")
--			
--			# Otherwise check if using an i386 or x86-64 device
--			elif platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64") :
--		
--				# Check if Python is running as 32-bit
--				if platform.architecture()[0].startswith("32") :
--				
--					# Set shared library
--					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.so")
--			
--				# Otherwise check if Python is running as 64-bit
--				elif platform.architecture()[0].startswith("64") :
--				
--					# Set shared library
--					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.so")
--		
--		# Otherwise check if running on Windows and using an i386 or x86-64 device
--		elif platform.uname()[0].startswith("Windows") and (platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64")) :
--		
--			# Check if Python is running as 32-bit
--			if platform.architecture()[0].startswith("32") :
--			
--				# Set shared library
--				self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.dll")
--		
--			# Otherwise check if Python is running as 64-bit
--			elif platform.architecture()[0].startswith("64") :
--			
--				# Set shared library
--				self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.dll")
--		
--		# Otherwise check if running on OS X and using an i386 or x86-64 device
--		elif platform.uname()[0].startswith("Darwin") and (platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64")) :
--		
--			# Check if Python is running as 32-bit
--			if platform.architecture()[0].startswith("32") :
--			
--				# Set shared library
--				self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.dylib")
--		
--			# Otherwise check if Python is running as 64-bit
--			elif platform.architecture()[0].startswith("64") :
--			
--				# Set shared library
--				self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.dylib")
--		
-+		self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/../../../libpreprocessor.so")
- 		# Check if shared library was set
- 		if self.sharedLibrary :
- 		
-diff --git a/shared library source/Makefile b/shared library source/Makefile
-index 9d015a1..a24f134 100644
---- a/shared library source/Makefile	
-+++ b/shared library source/Makefile	
-@@ -58,13 +58,15 @@ ifeq ($(TARGET_PLATFORM), OSX64)
- 	CFLAGS = -fPIC -m64 -stdlib=libc++ -O3 -Wl,-install_name,$(PROG)$(VER)
- endif
- 
-+PROG = lib$(LIBRARY_NAME).so
-+CC = g++
- SRCS = preprocessor.cpp gcode.cpp vector.cpp
--CFLAGS += -Wall -std=c++11 -fvisibility=hidden -shared
-+CFLAGS = -O3 -fPIC -Wall -std=c++11 -fvisibility=hidden -shared
- 
- all: $(PROG)
- 
- $(PROG):   $(SRCS)
--	$(CC) $(CFLAGS) -o ../octoprint_m3dfio/static/libraries/$(PROG) $(SRCS)
-+	$(CC) $(CFLAGS) -o $(PROG) $(SRCS)
- 
- clean:
- 	rm -f ../octoprint_m3dfio/static/libraries/$(PROG)
--- 
-2.7.1
-
diff --git a/pkgs/applications/misc/octoprint/m33-fio-one-library.patch b/pkgs/applications/misc/octoprint/m33-fio-one-library.patch
new file mode 100644
index 000000000000..968983696feb
--- /dev/null
+++ b/pkgs/applications/misc/octoprint/m33-fio-one-library.patch
@@ -0,0 +1,161 @@
+From 62b4fabd1d4ee7a584a565d48c7eaec6e80fe0bd Mon Sep 17 00:00:00 2001
+From: Nikolay Amiantov <ab@fmap.me>
+Date: Fri, 12 Aug 2016 23:41:22 +0300
+Subject: [PATCH] Build and use one version of preprocessor library
+
+---
+ octoprint_m33fio/__init__.py   | 66 +-----------------------------------------
+ shared library source/Makefile | 59 +++----------------------------------
+ 2 files changed, 5 insertions(+), 120 deletions(-)
+
+diff --git a/octoprint_m33fio/__init__.py b/octoprint_m33fio/__init__.py
+index da539f5..b0a17ad 100755
+--- a/octoprint_m33fio/__init__.py
++++ b/octoprint_m33fio/__init__.py
+@@ -979,71 +979,7 @@ class M33FioPlugin(
+ 		# Check if using shared library or checking if it is usable
+ 		if self._settings.get_boolean(["UseSharedLibrary"]) or isUsable :
+ 	
+-			# Check if running on Linux
+-			if platform.uname()[0].startswith("Linux") :
+-
+-				# Check if running on a Raspberry Pi 1
+-				if platform.uname()[4].startswith("armv6l") and self.getCpuHardware() == "BCM2708" :
+-	
+-					# Set shared library
+-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm1176jzf-s.so")
+-	
+-				# Otherwise check if running on a Raspberry Pi 2 or Raspberry Pi 3
+-				elif platform.uname()[4].startswith("armv7l") and self.getCpuHardware() == "BCM2709" :
+-	
+-					# Set shared library
+-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm_cortex-a7.so")
+-	
+-				# Otherwise check if running on an ARM7 device
+-				elif platform.uname()[4].startswith("armv7") :
+-	
+-					# Set shared library
+-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm7.so")
+-	
+-				# Otherwise check if using an i386 or x86-64 device
+-				elif platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64") :
+-
+-					# Check if Python is running as 32-bit
+-					if platform.architecture()[0].startswith("32") :
+-		
+-						# Set shared library
+-						self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.so")
+-	
+-					# Otherwise check if Python is running as 64-bit
+-					elif platform.architecture()[0].startswith("64") :
+-		
+-						# Set shared library
+-						self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.so")
+-
+-			# Otherwise check if running on Windows and using an i386 or x86-64 device
+-			elif platform.uname()[0].startswith("Windows") and (platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64")) :
+-
+-				# Check if Python is running as 32-bit
+-				if platform.architecture()[0].startswith("32") :
+-	
+-					# Set shared library
+-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.dll")
+-
+-				# Otherwise check if Python is running as 64-bit
+-				elif platform.architecture()[0].startswith("64") :
+-	
+-					# Set shared library
+-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.dll")
+-
+-			# Otherwise check if running on OS X and using an i386 or x86-64 device
+-			elif platform.uname()[0].startswith("Darwin") and (platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64")) :
+-
+-				# Check if Python is running as 32-bit
+-				if platform.architecture()[0].startswith("32") :
+-	
+-					# Set shared library
+-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.dylib")
+-
+-				# Otherwise check if Python is running as 64-bit
+-				elif platform.architecture()[0].startswith("64") :
+-	
+-					# Set shared library
+-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.dylib")
++			self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/libpreprocessor.so")
+ 
+ 			# Check if shared library was set
+ 			if self.sharedLibrary :
+diff --git a/shared library source/Makefile b/shared library source/Makefile
+index a43d657..0b254aa 100755
+--- a/shared library source/Makefile	
++++ b/shared library source/Makefile	
+@@ -1,62 +1,11 @@
+ # Target platform options: LINUX32, LINUX64, WINDOWS32, WINDOWS64, PI, PI2, ARM7, OSX32, OSX64
+-LIBRARY_NAME = preprocessor
++LIBRARY_NAME = libpreprocessor
+ TARGET_PLATFORM = LINUX64
+ VER = .1
+ 
+-ifeq ($(TARGET_PLATFORM), LINUX32)
+-	PROG = $(LIBRARY_NAME)_i386.so
+-	CC = g++
+-	CFLAGS = -fPIC -m32 -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
+-endif
+-
+-ifeq ($(TARGET_PLATFORM), LINUX64)
+-	PROG = $(LIBRARY_NAME)_x86-64.so
+-	CC = g++
+-	CFLAGS = -fPIC -m64 -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
+-endif
+-
+-ifeq ($(TARGET_PLATFORM), WINDOWS32)
+-	PROG = $(LIBRARY_NAME)_i386.dll
+-	CC = i686-w64-mingw32-g++
+-	CFLAGS = -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
+-endif
+-
+-ifeq ($(TARGET_PLATFORM), WINDOWS64)
+-	PROG = $(LIBRARY_NAME)_x86-64.dll
+-	CC = x86_64-w64-mingw32-g++
+-	CFLAGS = -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
+-endif
+-
+-ifeq ($(TARGET_PLATFORM), PI)
+-	PROG = $(LIBRARY_NAME)_arm1176jzf-s.so
+-	CC = ~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
+-	CFLAGS = -fPIC -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
+-endif
+-
+-ifeq ($(TARGET_PLATFORM), PI2)
+-	PROG = $(LIBRARY_NAME)_arm_cortex-a7.so
+-	CC = ~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
+-	CFLAGS = -fPIC -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
+-endif
+-
+-ifeq ($(TARGET_PLATFORM), ARM7)
+-	PROG = $(LIBRARY_NAME)_arm7.so
+-	CC = ~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++
+-	CFLAGS = -fPIC -mcpu=generic-armv7-a -mfpu=vfp -mfloat-abi=hard -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
+-endif
+-
+-ifeq ($(TARGET_PLATFORM), OSX32)
+-	PROG = $(LIBRARY_NAME)_i386.dylib
+-	CC = clang++
+-	CFLAGS = -fPIC -m32 -stdlib=libc++ -O3 -Wl,-install_name,$(PROG)$(VER)
+-
+-endif
+-
+-ifeq ($(TARGET_PLATFORM), OSX64)
+-	PROG = $(LIBRARY_NAME)_x86-64.dylib
+-	CC = clang++
+-	CFLAGS = -fPIC -m64 -stdlib=libc++ -O3 -Wl,-install_name,$(PROG)$(VER)
+-endif
++PROG = $(LIBRARY_NAME).so
++CC = g++
++CFLAGS = -fPIC -O3 -Wl,-soname,$(PROG)$(VER)
+ 
+ SRCS = preprocessor.cpp gcode.cpp vector.cpp
+ CFLAGS += -Wall -std=c++11 -fvisibility=hidden -shared
+-- 
+2.9.2
+
diff --git a/pkgs/applications/misc/octoprint/plugins.nix b/pkgs/applications/misc/octoprint/plugins.nix
index 852ec5b444dc..3c07bfa80e80 100644
--- a/pkgs/applications/misc/octoprint/plugins.nix
+++ b/pkgs/applications/misc/octoprint/plugins.nix
@@ -4,79 +4,84 @@ let
   buildPlugin = args: pythonPackages.buildPythonApplication (args // {
     buildInputs = (args.buildInputs or []) ++ [ octoprint ];
   });
-in {
 
-  m3d-fio = buildPlugin rec {
-    name = "M3D-Fio-${version}";
-    version = "0.32";
+  self = {
 
-    src = fetchFromGitHub {
-      owner = "donovan6000";
-      repo = "M3D-Fio";
-      rev = "V${version}";
-      sha256 = "1s15nx6v56yjwd88b19fx0gk1l0abp76nz10yicspdn91fpr1sf4";
-    };
+    # Deprecated alias
+    m3d-fio = self.m33-fio; # added 2016-08-13
 
-    patches = [
-      ./0001-Don-t-use-static-library.patch
-    ];
-
-    postInstall = ''
-    (
-      cd 'shared library source'
-      make
-      install -Dm755 libpreprocessor.so $out/lib/libpreprocessor.so
-    )
-    rm -rf $out/${pythonPackages.python.sitePackages}/octoprint_m3dfio/static/libraries
-    '';
-
-    meta = with stdenv.lib; {
-      homepage = "https://github.com/donovan6000/M3D-Fio";
-      description = "OctoPrint plugin for the Micro 3D printer";
-      platforms = platforms.all;
-      license = licenses.gpl3;
-      maintainers = with maintainers; [ abbradar ];
-    };
-  };
+    m33-fio = buildPlugin rec {
+      name = "M33-Fio-${version}";
+      version = "1.5";
 
-  titlestatus = buildPlugin rec {
-    name = "OctoPrint-TitleStatus-${version}";
-    version = "0.0.4";
+      src = fetchFromGitHub {
+        owner = "donovan6000";
+        repo = "M33-Fio";
+        rev = "V${version}";
+        sha256 = "0ss8ic9l5srb5wj2mj0qafam0z4d6zv0cixhxgghh03fp0lvwjyq";
+      };
 
-    src = fetchFromGitHub {
-      owner = "MoonshineSG";
-      repo = "OctoPrint-TitleStatus";
-      rev = version;
-      sha256 = "1l78xrabn5hcly2mgxwi17nwgnp2s6jxi9iy4wnw8k8icv74ag7k";
-    };
+      patches = [
+        ./m33-fio-one-library.patch
+      ];
+
+      postPatch = ''
+        rm -rf octoprint_m33fio/static/libraries/*
+        (
+          cd 'shared library source'
+          make
+        )
+      '';
 
-    meta = with stdenv.lib; {
-      homepage = https://github.com/MoonshineSG/OctoPrint-TitleStatus;
-      description = "Show printers status in window title";
-      platforms = platforms.all;
-      license = licenses.agpl3;
-      maintainers = with maintainers; [ abbradar ];
+      meta = with stdenv.lib; {
+        homepage = "https://github.com/donovan6000/M3D-Fio";
+        description = "OctoPrint plugin for the Micro 3D printer";
+        platforms = platforms.all;
+        license = licenses.gpl3;
+        maintainers = with maintainers; [ abbradar ];
+      };
     };
-  };
 
-  stlviewer = buildPlugin rec {
-    name = "OctoPrint-STLViewer-${version}";
-    version = "0.3.0";
+    titlestatus = buildPlugin rec {
+      name = "OctoPrint-TitleStatus-${version}";
+      version = "0.0.4";
+
+      src = fetchFromGitHub {
+        owner = "MoonshineSG";
+        repo = "OctoPrint-TitleStatus";
+        rev = version;
+        sha256 = "1l78xrabn5hcly2mgxwi17nwgnp2s6jxi9iy4wnw8k8icv74ag7k";
+      };
 
-    src = fetchFromGitHub {
-      owner = "jneilliii";
-      repo = "OctoPrint-STLViewer";
-      rev = "v${version}";
-      sha256 = "1a6sa8pw9ay7x27pfwr3nzb22x3jaw0c9vwyz4mrj76zkiw6svfi";
+      meta = with stdenv.lib; {
+        homepage = "https://github.com/MoonshineSG/OctoPrint-TitleStatus";
+        description = "Show printers status in window title";
+        platforms = platforms.all;
+        license = licenses.agpl3;
+        maintainers = with maintainers; [ abbradar ];
+      };
     };
 
-    meta = with stdenv.lib; {
-      homepage = https://github.com/jneilliii/Octoprint-STLViewer;
-      description = "A simple stl viewer tab for OctoPrint";
-      platforms = platforms.all;
-      license = licenses.agpl3;
-      maintainers = with maintainers; [ abbradar ];
+    stlviewer = buildPlugin rec {
+      name = "OctoPrint-STLViewer-${version}";
+      version = "0.3.0";
+
+      src = fetchFromGitHub {
+        owner = "jneilliii";
+        repo = "OctoPrint-STLViewer";
+        rev = "v${version}";
+        sha256 = "1a6sa8pw9ay7x27pfwr3nzb22x3jaw0c9vwyz4mrj76zkiw6svfi";
+      };
+
+      meta = with stdenv.lib; {
+        homepage = "https://github.com/jneilliii/Octoprint-STLViewer";
+        description = "A simple stl viewer tab for OctoPrint";
+        platforms = platforms.all;
+        license = licenses.agpl3;
+        maintainers = with maintainers; [ abbradar ];
+      };
     };
+
   };
 
-}
+in self