From 51dc91ef1c7b55859c68c0b55419e5b6fbdf2c4c Mon Sep 17 00:00:00 2001 From: layman Date: Wed, 19 May 2021 10:41:18 +0200 Subject: [PATCH] Fixed pcb2gcode for gcc 11 --- sci-electronics/pcb2gcode/Manifest | 3 +- .../files/pcb2gcode-9999-gcc-11.patch | 330 ++++++++++++++++++ .../pcb2gcode/pcb2gcode-9999.ebuild | 2 + 3 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 sci-electronics/pcb2gcode/files/pcb2gcode-9999-gcc-11.patch diff --git a/sci-electronics/pcb2gcode/Manifest b/sci-electronics/pcb2gcode/Manifest index 2d6dd4d..1c091a6 100644 --- a/sci-electronics/pcb2gcode/Manifest +++ b/sci-electronics/pcb2gcode/Manifest @@ -1 +1,2 @@ -EBUILD pcb2gcode-9999.ebuild 1045 BLAKE2B a4785bd2fbe01259704afa2a57726f98d49c0d36ca9b216c504429167db79c794edd37c9438f256e78fde74f8dcd7c8102bca37e1ed16d5a48311e6a09aab56c SHA512 5f7a3e983a34652b432583ecebf6d730f4c83f276b25fc8ff06b8ccf9f2d6a9d9c697977c822dc85cd3a049fca5a109a6fc7ab2e325b0ea59a1f0ead6dc9485a +AUX pcb2gcode-9999-gcc-11.patch 16034 BLAKE2B 112322dac10529fb51217d237be144c55800ccc642e8d56212f7e4a2355be1af9ef90bea2e3b14e8c5b5d3074433284d0a8e755cfc809bca3f84e4b8ef36d78b SHA512 3cc777212f45ad0c4d489feb90f5ec2f46d1e67f5f231d034dc695464dfd8adaefd0533431cfaf7828c8071a67261415de992f338aac7b3f25936ad0f25389fa +EBUILD pcb2gcode-9999.ebuild 1086 BLAKE2B b87dfb99fcef6d23556458e8946dcd0ae9046974f3d396d6a597786ae7f5787991c4638be4f9cfba94e4aa766b2c1c59bfc5a4a04f84bc044d2973452cc9a2d8 SHA512 b020d07d2e8705ab748e22929d2d016e3d5137fa04f74e17631e34c1e308a8e5ee464152d1248868ba54e01aa87221801eb82d1d50757e639b095fe72410756f diff --git a/sci-electronics/pcb2gcode/files/pcb2gcode-9999-gcc-11.patch b/sci-electronics/pcb2gcode/files/pcb2gcode-9999-gcc-11.patch new file mode 100644 index 0000000..aef8e30 --- /dev/null +++ b/sci-electronics/pcb2gcode/files/pcb2gcode-9999-gcc-11.patch @@ -0,0 +1,330 @@ +diff -urN pcb2gcode-9999.orig/path_finding.cpp pcb2gcode-9999/path_finding.cpp +--- pcb2gcode-9999.orig/path_finding.cpp 2021-05-19 10:04:48.238921433 +0200 ++++ pcb2gcode-9999/path_finding.cpp 2021-05-19 10:10:38.227035983 +0200 +@@ -28,7 +28,7 @@ + namespace path_finding { + + using boost::optional; +-using boost::make_optional; ++//using boost::make_optional; + + Neighbors::iterator Neighbors::iterator::operator++() { + const auto& all_vertices_size = neighbors->vertices.size(); +@@ -440,7 +440,7 @@ + open_set.pop(); + if (current == goal) { + // We're done. +- return make_optional(build_path(current, came_from)); ++ return boost::make_optional(build_path(current, came_from)); + } + if (closed_set.count(current) > 0) { + // Skip this because we already "removed it", sort of. +diff -urN pcb2gcode-9999.orig/path_finding_tests.cpp pcb2gcode-9999/path_finding_tests.cpp +--- pcb2gcode-9999.orig/path_finding_tests.cpp 2021-05-19 10:04:48.239921443 +0200 ++++ pcb2gcode-9999/path_finding_tests.cpp 2021-05-19 10:10:24.618914885 +0200 +@@ -7,7 +7,7 @@ + #include "bg_helpers.hpp" + + #include +-using boost::make_optional; ++//using boost::make_optional; + + #include + +@@ -126,7 +126,7 @@ + multi_polygon_type_fp mp; + box_type_fp box{point_type_fp{0,0}, {10,10}}; + bg::convert(box, mp); +- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), make_optional(MPRingIndices({{0, {0}}}))); ++ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), boost::make_optional(MPRingIndices({{0, {0}}}))); + BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{11,11}, mp), boost::none); + } + +@@ -149,10 +149,10 @@ + bg::convert(hole, hole_mp); + mp = mp - hole_mp; + +- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), make_optional(MPRingIndices({{0, {0, 1}}}))); ++ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), boost::make_optional(MPRingIndices({{0, {0, 1}}}))); + BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{11,11}, mp), boost::none); + BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{5,5}, mp), boost::none); +- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{21,1}, mp), make_optional(MPRingIndices({{1, {0, 1, 2}}}))); ++ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{21,1}, mp), boost::make_optional(MPRingIndices({{1, {0, 1, 2}}}))); + BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{23.5,3.5}, mp), boost::none); + } + +@@ -171,9 +171,9 @@ + hole = {point_type_fp{30,30}, {70,70}}; + bg::convert(hole, hole_mp); + mp = mp - hole_mp; +- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), make_optional(MPRingIndices({{0, {0, 1}}}))); ++ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{1,1}, mp), boost::make_optional(MPRingIndices({{0, {0, 1}}}))); + BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{11,11}, mp), boost::none); +- BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{21,21}, mp), make_optional(MPRingIndices({{1, {0, 1}}}))); ++ BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{21,21}, mp), boost::make_optional(MPRingIndices({{1, {0, 1}}}))); + BOOST_CHECK_EQUAL(inside_multipolygon(point_type_fp{31,31}, mp), boost::none); + } + +@@ -190,7 +190,7 @@ + box_type_fp box{point_type_fp{0,0}, {10,10}}; + bg::convert(box, mp); + BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{1,1}, mp), boost::none); +- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), make_optional(MPRingIndices({{0, {0}}}))); ++ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), boost::make_optional(MPRingIndices({{0, {0}}}))); + } + + BOOST_AUTO_TEST_CASE(doughnuts) { +@@ -213,10 +213,10 @@ + mp = mp - hole_mp; + + BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{1,1}, mp), boost::none); +- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), make_optional(MPRingIndices({{0, {0}}, {1, {0}}}))); +- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{5,5}, mp), make_optional(MPRingIndices({{0, {1}}, {1, {0}}}))); ++ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), boost::make_optional(MPRingIndices({{0, {0}}, {1, {0}}}))); ++ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{5,5}, mp), boost::make_optional(MPRingIndices({{0, {1}}, {1, {0}}}))); + BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{21,1}, mp), boost::none); +- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{23.5,3.5}, mp), make_optional(MPRingIndices({{0, {0}}, {1, {1}}}))); ++ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{23.5,3.5}, mp), boost::make_optional(MPRingIndices({{0, {0}}, {1, {1}}}))); + } + + BOOST_AUTO_TEST_CASE(nested_doughnuts) { +@@ -236,9 +236,9 @@ + mp = mp - hole_mp; + + BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{1,1}, mp), boost::none); +- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), make_optional(MPRingIndices({{0, {1}}, {1, {0}}}))); ++ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{11,11}, mp), boost::make_optional(MPRingIndices({{0, {1}}, {1, {0}}}))); + BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{21,21}, mp), boost::none); +- BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{31,31}, mp), make_optional(MPRingIndices({{0, {1}}, {1, {1}}}))); ++ BOOST_CHECK_EQUAL(outside_multipolygon(point_type_fp{31,31}, mp), boost::make_optional(MPRingIndices({{0, {1}}, {1, {1}}}))); + } + + BOOST_AUTO_TEST_SUITE_END() // outside_multipolygon_tests +@@ -247,16 +247,16 @@ + + BOOST_AUTO_TEST_CASE(open_space) { + auto surface = PathFindingSurface(boost::none, multi_polygon_type_fp(), 5); +- BOOST_CHECK_EQUAL(surface.in_surface({1,1}), make_optional(size_t(0))); ++ BOOST_CHECK_EQUAL(surface.in_surface({1,1}), boost::make_optional(size_t(0))); + } + + BOOST_AUTO_TEST_CASE(barbell) { + multi_polygon_type_fp barbell{{{{0,0}, {0,100}, {40,100}, {40,2}, {60,2}, + {60,100}, {100,100}, {100,0}, {0,0}}}}; + auto surface = PathFindingSurface(boost::none, barbell, 5); +- BOOST_CHECK_EQUAL(surface.in_surface({1,1}), make_optional(size_t(0))); ++ BOOST_CHECK_EQUAL(surface.in_surface({1,1}), boost::make_optional(size_t(0))); + BOOST_CHECK_EQUAL(surface.in_surface({6,6}), boost::none); +- BOOST_CHECK_EQUAL(surface.in_surface({-10,-10}), make_optional(size_t(0))); ++ BOOST_CHECK_EQUAL(surface.in_surface({-10,-10}), boost::make_optional(size_t(0))); + BOOST_CHECK_EQUAL(surface.in_surface({10,10}), boost::none); + } + +@@ -266,12 +266,12 @@ + {51,80}, {51,100}, {100,100}, + {100,0}, {0,0}}}}; + auto surface = PathFindingSurface(almost_doughnut, multi_polygon_type_fp(), 5); +- BOOST_CHECK_EQUAL(surface.in_surface({1,1}), make_optional(size_t(0))); +- BOOST_CHECK_EQUAL(surface.in_surface({6,6}), make_optional(size_t(0))); ++ BOOST_CHECK_EQUAL(surface.in_surface({1,1}), boost::make_optional(size_t(0))); ++ BOOST_CHECK_EQUAL(surface.in_surface({6,6}), boost::make_optional(size_t(0))); + BOOST_CHECK_EQUAL(surface.in_surface({-10,-10}), boost::none); +- BOOST_CHECK_EQUAL(surface.in_surface({50,1}), make_optional(size_t(0))); ++ BOOST_CHECK_EQUAL(surface.in_surface({50,1}), boost::make_optional(size_t(0))); + BOOST_CHECK_EQUAL(surface.in_surface({50,50}), boost::none); +- BOOST_CHECK_EQUAL(surface.in_surface({50,90}), make_optional(size_t(0))); ++ BOOST_CHECK_EQUAL(surface.in_surface({50,90}), boost::make_optional(size_t(0))); + } + + BOOST_AUTO_TEST_SUITE_END() // nested_multipolygon_type_fp +@@ -285,7 +285,7 @@ + linestring_type_fp expected; + expected.push_back(point_type_fp(0, 0)); + expected.push_back(point_type_fp(1, 1)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(simple) { +@@ -299,7 +299,7 @@ + linestring_type_fp expected; + expected.push_back(point_type_fp(0, 0)); + expected.push_back(point_type_fp(1, 1)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(simple_limit0) { +@@ -309,7 +309,7 @@ + bg::convert(bounding_box, keep_in); + auto surface = PathFindingSurface(keep_in, multi_polygon_type_fp(), 0.1); + auto ret = surface.find_path(point_type_fp(0,0), point_type_fp(1,1), +- infinity, make_optional(size_t(0))); ++ infinity, boost::make_optional(size_t(0))); + BOOST_CHECK_EQUAL(ret, boost::none); + } + +@@ -320,11 +320,11 @@ + bg::convert(bounding_box, keep_in); + auto surface = PathFindingSurface(keep_in, multi_polygon_type_fp(), 0.1); + auto ret = surface.find_path(point_type_fp(0,0), point_type_fp(1,1), +- infinity, make_optional(size_t(1))); ++ infinity, boost::make_optional(size_t(1))); + linestring_type_fp expected; + expected.push_back(point_type_fp(0, 0)); + expected.push_back(point_type_fp(1, 1)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(simple_limit_length200) { +@@ -338,7 +338,7 @@ + linestring_type_fp expected; + expected.push_back(point_type_fp(0, 0)); + expected.push_back(point_type_fp(100, 100)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(simple_limit_length100) { +@@ -368,7 +368,7 @@ + linestring_type_fp expected; + expected.push_back(point_type_fp(0, 0)); + expected.push_back(point_type_fp(1, 1)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(hole_unreachable) { +@@ -410,7 +410,7 @@ + expected.push_back(point_type_fp(0, 0)); + expected.push_back(point_type_fp(3, 7)); + expected.push_back(point_type_fp(10, 10)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(box_no_keep_in) { +@@ -434,7 +434,7 @@ + expected.push_back(point_type_fp(0, 0)); + expected.push_back(point_type_fp(3, 7)); + expected.push_back(point_type_fp(10, 10)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(unreachable_box) { +@@ -485,7 +485,7 @@ + expected.push_back(point_type_fp(0, 0)); + expected.push_back(point_type_fp(3, 7)); + expected.push_back(point_type_fp(10, 10)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(u_shape) { +@@ -512,7 +512,7 @@ + expected.push_back(point_type_fp(3, 3)); + expected.push_back(point_type_fp(7, 3)); + expected.push_back(point_type_fp(9, 9)); +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(doughnut) { +@@ -526,7 +526,7 @@ + infinity, boost::none); + + linestring_type_fp expected{{10, 10},{30, 70},{51, 80},{90, 90}}; +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_CASE(barbell_search) { +@@ -542,7 +542,7 @@ + multi_polygon_type_fp barbell{{{{0,0}, {0,50}, {40,50}, {40,2}, {60,2}, + {60,50}, {100,50}, {100,0}, {0,0}}}}; + auto surface = PathFindingSurface(boost::none, barbell, 5); +- BOOST_CHECK_EQUAL(surface.find_path({-10,-10},{110,60},infinity, make_optional(size_t(2))), ++ BOOST_CHECK_EQUAL(surface.find_path({-10,-10},{110,60},infinity, boost::make_optional(size_t(2))), + boost::none); + } + +@@ -563,7 +563,7 @@ + auto ret = surface.find_path({5,5}, point_type_fp(-1,-1), + infinity, boost::none); + linestring_type_fp expected{{5,5},{3,10},{0,10},{-1,-1}}; +- BOOST_CHECK_EQUAL(ret, make_optional(expected)); ++ BOOST_CHECK_EQUAL(ret, boost::make_optional(expected)); + } + + BOOST_AUTO_TEST_SUITE_END() +diff -urN pcb2gcode-9999.orig/surface_vectorial.cpp pcb2gcode-9999/surface_vectorial.cpp +--- pcb2gcode-9999.orig/surface_vectorial.cpp 2021-05-19 10:04:48.239921443 +0200 ++++ pcb2gcode-9999/surface_vectorial.cpp 2021-05-19 10:11:21.585421829 +0200 +@@ -58,7 +58,7 @@ + #include + #include + using boost::optional; +-using boost::make_optional; ++//using boost::make_optional; + + #include "flatten.hpp" + #include "tsp_solver.hpp" +@@ -723,7 +723,7 @@ + const double max_g1_distance = std::isinf(mill->backtrack) ? + g0_time * horizontalG1speed : + mill->backtrack*g0_time / (1 + mill->backtrack/horizontalG1speed); +- return path_finding_surface.find_path(a, b, max_g1_distance, make_optional(mill->path_finding_limit)); ++ return path_finding_surface.find_path(a, b, max_g1_distance, boost::make_optional(mill->path_finding_limit)); + }; + } + +@@ -839,7 +839,7 @@ + if (!reverse_spikes) { + if (polygon_index > 0) { + spike_offset = diameter - overlap; +- spikes_keep_out = make_optional(multi_polygon_type_fp{polygons[polygon_index - 1]}); ++ spikes_keep_out = boost::make_optional(multi_polygon_type_fp{polygons[polygon_index - 1]}); + } else { + spike_offset = 0; + } +@@ -850,17 +850,17 @@ + if (extra_passes % 2 == 0) { + if (polygon_index + 1 < polygons.size()) { + spike_offset = diameter - overlap; +- spikes_keep_in = make_optional(multi_polygon_type_fp{polygons[polygon_index + 1]}); ++ spikes_keep_in = boost::make_optional(multi_polygon_type_fp{polygons[polygon_index + 1]}); + } else { + spike_offset = 0; + } + } else { + if (polygon_index + 1 < polygons.size()) { + spike_offset = diameter - overlap; +- spikes_keep_in = make_optional(multi_polygon_type_fp{polygons[polygon_index + 1]}); ++ spikes_keep_in = boost::make_optional(multi_polygon_type_fp{polygons[polygon_index + 1]}); + } else { + spike_offset = (diameter - overlap)/2; +- spikes_keep_in = make_optional(multi_polygon_type_fp{current_voronoi}); ++ spikes_keep_in = boost::make_optional(multi_polygon_type_fp{current_voronoi}); + } + } + } +@@ -985,7 +985,7 @@ + for (const auto& poly : vectorial_surface->first) { + keep_outs.push_back(bg_helpers::buffer(poly, tool_diameter/2 + isolator->offset)); + } +- const auto path_finding_surface = path_finding::PathFindingSurface(mask ? make_optional(mask->vectorial_surface->first) : boost::none, sum(keep_outs), isolator->tolerance); ++ const auto path_finding_surface = path_finding::PathFindingSurface(mask ? boost::make_optional(mask->vectorial_surface->first) : boost::none, sum(keep_outs), isolator->tolerance); + for (size_t trace_index = 0; trace_index < trace_count; trace_index++) { + multi_polygon_type_fp already_milled_shrunk = + bg_helpers::buffer(already_milled[trace_index], -tool_diameter/2 + tolerance); +@@ -1033,7 +1033,7 @@ + const string tool_suffix = tool_count > 1 ? "_" + std::to_string(tool_index) : ""; + write_svgs(tool_suffix, tool_diameter, new_trace_toolpaths, isolator->tolerance, tool_index == tool_count - 1); + auto new_toolpath = flatten(new_trace_toolpaths); +- multi_linestring_type_fp combined_toolpath = post_process_toolpath(mill, make_optional(&path_finding_surface), new_toolpath); ++ multi_linestring_type_fp combined_toolpath = post_process_toolpath(mill, boost::make_optional(&path_finding_surface), new_toolpath); + write_svgs("_final" + tool_suffix, tool_diameter, combined_toolpath, isolator->tolerance, tool_index == tool_count - 1); + results[tool_index] = make_pair(tool_diameter, mirror_toolpath(combined_toolpath, mirror, ymirror)); + } diff --git a/sci-electronics/pcb2gcode/pcb2gcode-9999.ebuild b/sci-electronics/pcb2gcode/pcb2gcode-9999.ebuild index d55c1d2..ce19332 100644 --- a/sci-electronics/pcb2gcode/pcb2gcode-9999.ebuild +++ b/sci-electronics/pcb2gcode/pcb2gcode-9999.ebuild @@ -30,6 +30,8 @@ DEPEND="dev-cpp/gtkmm:2.4 ${RDEPEND}" src_prepare() { + eapply "${FILESDIR}/${P}-gcc-11.patch" + if [[ ${PV} == "9999" ]] ; then eautoreconf fi