Skip to content

Commit

Permalink
cad/libbgcode: new port
Browse files Browse the repository at this point in the history
It is required by PrusaSlicer 2.7+. This port provides library and
binary to work with g-code (read/write/convert)

Reported by: Teodor Sigaev <teodorsigaev@gmail.com>
Reviewed by: lwhsu (mentor)
Sponsored by: Postgres Professional
Differential Revision: https://reviews.freebsd.org/D44257
  • Loading branch information
mizhka committed Mar 28, 2024
1 parent efa7dda commit 9784fb2
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 0 deletions.
1 change: 1 addition & 0 deletions cad/Makefile
Expand Up @@ -74,6 +74,7 @@
SUBDIR += ldview
SUBDIR += leocad
SUBDIR += lepton-eda
SUBDIR += libbgcode
SUBDIR += libgdsii
SUBDIR += libopencad
SUBDIR += librecad
Expand Down
27 changes: 27 additions & 0 deletions cad/libbgcode/Makefile
@@ -0,0 +1,27 @@
PORTNAME= libbgcode
DISTVERSION= 0.2.0
CATEGORIES= cad

MAINTAINER= teodorsigaev@gmail.com
COMMENT= Prusa Block & Binary G-code reader/writer/converter
WWW= https://github.com/prusa3d/libbgcode

LICENSE= AGPLv3
LICENSE_FILE= ${WRKSRC}/LICENSE

LIB_DEPENDS= libboost_nowide.so:devel/boost-libs

USES= cmake

USE_GITHUB= yes
GH_ACCOUNT= prusa3d
GH_TAGNAME= 6f43cb004ef3d3bda37dde49f6235e24d2717629
GH_TUPLE= atomicobject:heatshrink:v0.4.1:heatshrink

CMAKE_ARGS+= -DBUILD_SHARED_LIBS=ON \
-DLibBGCode_BUILD_DEPS=ON \
-DLibBGCode_BUILD_TESTS=OFF

PORTDATA= *

.include <bsd.port.mk>
5 changes: 5 additions & 0 deletions cad/libbgcode/distinfo
@@ -0,0 +1,5 @@
TIMESTAMP = 1709747111
SHA256 (prusa3d-libbgcode-0.2.0-6f43cb004ef3d3bda37dde49f6235e24d2717629_GH0.tar.gz) = 315349d55fcee2eaf41ca7ba6a4b8e0e442c74b04f6074d6e108c169fa36e908
SIZE (prusa3d-libbgcode-0.2.0-6f43cb004ef3d3bda37dde49f6235e24d2717629_GH0.tar.gz) = 455740
SHA256 (atomicobject-heatshrink-v0.4.1_GH0.tar.gz) = 7529a1c8ac501191ad470b166773364e66d9926aad632690c72c63a1dea7e9a6
SIZE (atomicobject-heatshrink-v0.4.1_GH0.tar.gz) = 36945
13 changes: 13 additions & 0 deletions cad/libbgcode/files/patch-CMakeLists.txt
@@ -0,0 +1,13 @@
--- CMakeLists.txt.orig 2024-03-06 18:20:01 UTC
+++ CMakeLists.txt
@@ -27,10 +27,6 @@ endif ()
include(deps/autobuild.cmake)
endif ()

-if (NOT CMAKE_DEBUG_POSTFIX)
- set(CMAKE_DEBUG_POSTFIX "d")
-endif ()
-
include(CMakeDependentOption)
cmake_dependent_option(${PROJECT_NAME}_BUILD_COMPONENT_Convert "Include Convert component in the library" ON
"${PROJECT_NAME}_BUILD_COMPONENT_Binarize" OFF)
23 changes: 23 additions & 0 deletions cad/libbgcode/files/patch-deps_CMakeLists.txt
@@ -0,0 +1,23 @@
--- deps/CMakeLists.txt.orig 2024-01-22 12:56:01 UTC
+++ deps/CMakeLists.txt
@@ -41,16 +41,16 @@ include(${PROJECT_SOURCE_DIR}/../cmake/modules/AddCMak

include(${PROJECT_SOURCE_DIR}/../cmake/modules/AddCMakeProject.cmake)

-set(supported_packages Boost heatshrink Catch2 ZLIB pybind11)
+set(supported_packages heatshrink)

include(CMakeDependentOption)
option(${PROJECT_NAME}_SELECT_ALL "Choose all external projects to be selected (create build target for them)." ON)
option(${PROJECT_NAME}_BUILD_ALL "Choose all external projects to be built." OFF)

-find_package(Git REQUIRED)
-
+#find_package(Git REQUIRED)
+#
# The default command line for patching. Only works for newer
-set(PATCH_CMD ${GIT_EXECUTABLE} apply --verbose --ignore-space-change --whitespace=fix)
+#set(PATCH_CMD ${GIT_EXECUTABLE} apply --verbose --ignore-space-change --whitespace=fix)

foreach (pkg ${supported_packages})
option(${PROJECT_NAME}_BUILD_${pkg} "Select package ${pkg} to be built." OFF)
12 changes: 12 additions & 0 deletions cad/libbgcode/files/patch-deps_heatshrink_heatshrink.cmake
@@ -0,0 +1,12 @@
--- deps/heatshrink/heatshrink.cmake.orig 2023-11-16 13:57:12 UTC
+++ deps/heatshrink/heatshrink.cmake
@@ -1,6 +1,5 @@
add_cmake_project(heatshrink
- URL https://github.com/atomicobject/heatshrink/archive/refs/tags/v0.4.1.zip
- URL_HASH SHA256=2e2db2366bdf36cb450f0b3229467cbc6ea81a8c690723e4227b0b46f92584fe
+ URL file://../../heatshrink-0.4.1
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt ./CMakeLists.txt &&
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in ./Config.cmake.in
-)
\ No newline at end of file
+)
2 changes: 2 additions & 0 deletions cad/libbgcode/pkg-descr
@@ -0,0 +1,2 @@
Prusa Block & Binary G-code reader/writer/converter.
libbgcode provides three API: core, binarize and convert.
21 changes: 21 additions & 0 deletions cad/libbgcode/pkg-plist
@@ -0,0 +1,21 @@
bin/bgcode
include/LibBGCode/binarize/binarize.hpp
include/LibBGCode/binarize/export.h
include/LibBGCode/convert/convert.hpp
include/LibBGCode/convert/export.h
include/LibBGCode/core/core.hpp
include/LibBGCode/core/export.h
lib/cmake/LibBGCode/LibBGCodeBinarizeTargets-%%CMAKE_BUILD_TYPE%%.cmake
lib/cmake/LibBGCode/LibBGCodeBinarizeTargets.cmake
lib/cmake/LibBGCode/LibBGCodeConfig.cmake
lib/cmake/LibBGCode/LibBGCodeConfigVersion.cmake
lib/cmake/LibBGCode/LibBGCodeConvertTargets-%%CMAKE_BUILD_TYPE%%.cmake
lib/cmake/LibBGCode/LibBGCodeConvertTargets.cmake
lib/cmake/LibBGCode/LibBGCodeCoreTargets-%%CMAKE_BUILD_TYPE%%.cmake
lib/cmake/LibBGCode/LibBGCodeCoreTargets.cmake
lib/libbgcode_binarize.so
lib/libbgcode_binarize.so.0.2.0
lib/libbgcode_convert.so
lib/libbgcode_convert.so.0.2.0
lib/libbgcode_core.so
lib/libbgcode_core.so.0.2.0

0 comments on commit 9784fb2

Please sign in to comment.