1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00
nixpkgs/pkgs/applications/misc/octoprint/0001-Don-t-use-static-library.patch
2016-03-12 18:51:49 +03:00

114 lines
4.6 KiB
Diff

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