ThisIsNotRocketScience / GerberTools

Tools to load/edit/create/panelizer sets of gerber files
MIT License
723 stars 143 forks source link

HOW TO build from source on Mono #53

Open ulidtko opened 6 years ago

ulidtko commented 6 years ago

This is how you build the GerberPanelizer from source on Linux.

Get @runesoeknudsen branch

git remote add github-pr-41 https://github.com/runesoeknudsen/GerberTools
git fetch github-pr-41
git checkout linuxHAck

Obtain dependency: Triangle.dll

This one is clean and easy.

git clone https://github.com/eppz/Triangle.NET
cd Triangle.NET/Triangle.NET
xbuild
cp Triangle/bin/Debug/Triangle.dll /tmp

Obtain dependency: DotNetZip.dll

This repo has it: https://github.com/haf/DotNetZip.Semverd Can be done from source, but requires Ruby tools for that. I preferred to pull the DotNetZip.1.11.0.nupkg package from their Appveyor CI. The .nupkg is just a zip file, the dll is inside.

Obtain dependency: OpenTK

https://www.nuget.org/packages/OpenTK/3.0.0-pre https://www.nuget.org/packages/OpenTK.GLControl/3.0.0-pre

Patch up the source a bit

This diff was somehow necessary to get it to compile as well:

diff --git i/GerberPanelizer/GerberPanelize.cs w/GerberPanelizer/GerberPanelize.cs
index b30d7fc..59ed2b7 100644
--- i/GerberPanelizer/GerberPanelize.cs
+++ w/GerberPanelizer/GerberPanelize.cs
@@ -656,7 +656,7 @@ namespace GerberCombinerBuilder

             GL.Disable(EnableCap.DepthTest);
             GL.Enable(EnableCap.Blend);
-            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
+            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
             GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest);
             GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest);

diff --git i/GerberPanelizer/QuickFont/QFont.cs w/GerberPanelizer/QuickFont/QFont.cs
index 0ab0d53..fa97c9d 100644
--- i/GerberPanelizer/QuickFont/QFont.cs
+++ w/GerberPanelizer/QuickFont/QFont.cs
@@ -588,7 +588,7 @@ namespace QuickFont

                 if (Options.UseDefaultBlendFunction)
                 {
-                    GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
+                    GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
                 }

             }
@@ -1137,7 +1137,7 @@ namespace QuickFont
                 if (Options.UseDefaultBlendFunction)
                 {

-                    GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
+                    GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);

                 }
             }

Start compilation

cd GerberTools/GerberPanelizer
xbuild

Finally, run it

mono bin/Debug/GerberPanelizer.exe
deece commented 5 years ago

This is obsoleted, build.sh now fetches the deps & builds things, there are still issues with corrupted icons in the resource files though.

celem commented 2 years ago

I'm running Linux Mint 20.3 with mono-complete installed. build.sh fails with "The type or namespace name `Ionic' could not be found". Any suggestions on how to proceed?

ulidtko commented 2 years ago

@celem you'd proceed just the same as any other dependency (for C# code in this case): step 1, find out what it is; step 2, install it so that the compiler is able to locate it.

For example, step 1 — grep the source for Ionic. You'll find using Ionic.Zip; lines — those are imports in C#. Obviously, since you're getting the error, it's not available in mono-complete; thus, an external dependency. Pretty easy to find its package.

The nuget package page says:

⚠ This package has been deprecated as it is legacy and is no longer maintained. Suggested Alternatives DotNetZip 1.9.1.8

... Did you follow the instructions? Also see PRs #128 #41.