# Porting software to FreeBSD



## sig (Apr 28, 2021)

I currently use a certain mail program (Mailspring) for multiple email clients on my Linux machines. I was wondering how hard it would be or if it is even possible to Port this to FreeBSD? Looking for some very good detailed instructions on doing so. Any help would be greatly appreciated.

Thanks!


----------



## SirDice (Apr 28, 2021)

Start here: FreeBSD Porter's Handbook


----------



## zirias@ (Apr 28, 2021)

It's an electron app. Electron is the pest for porting (and the porter's handbook will be of little help here). I really wouldn't recommend trying to start with such a thing…


----------



## sig (Apr 28, 2021)

Zirias said:


> It's an electron app. Electron is the pest for porting (and the porter's handbook will be of little help here). I really wouldn't recommend trying to start with such a thing…


Well that's a bummer because this has been such an awesome email client that works very well in OSX and Linux. Was really hoping to here that it could be done.


----------



## zirias@ (Apr 28, 2021)

It's opensource, so it can be done. But it's not a port one should tackle as a beginner. Electron is the opposite of being friendly to things like reproducible builds, fetching of required distfiles, packaging, etc…

As an example, have a look at the port for Visual Studio Code: https://cgit.freebsd.org/ports/tree/editors/vscode/Makefile

I think this whole idea of "write a desktop app as if you were writing a browser app" is flawed and don't understand why people are using it…


----------



## Menelkir (Apr 28, 2021)

Some months ago I've tried porting (I don't remember what software exactly) that used electron. It had so many chimichangas that I gave up. They say it's "simple because it's a web as desktop app" but actually isn't that simple and most of the time it relies on an horrid group of extra things. For linux usually is more straight-forward because they give you an appimage (that could work on freebsd, depending on the scenario) or just a binary thing that you can throw somewhere and run. 
Back to the point, check what you have inside the mailspring package, if the app is just a simple .asar (like authy) you're lucky so you just need to run something like "electron app.asar". AFAIK, mailspring depends on some extra stuff, maybe it works just starting the app.asar.


----------



## astyle (May 5, 2021)

I personally just use whatever browser-based interface the email system provides. Yeah, you can hook Outlook up to Gmail, or to a different email service. Or, you can hook up any smartphone to any email service. SirDice has very good advice on how to start a porting project, but be prepared to spend a few months at least, learning both the Ports system and Electron/JavaScript and C/C++ and how to make the whole enchilada work, starting with a simple helloworld program. 

If you have the patience and determination and skill for something like that, there's nothing to stop you from going down that road. Otherwise, I think you'd be better off looking in the FreeBSD ports for a replacement email client - there's plenty of alternatives.


----------



## forquare (May 6, 2021)

I attempted to port Nylas N1(which became Mailspring) back in 2016, I'd already created a port for a very easy Go application (www/gohugo) and was high on success.  Attempting to port N1 brought me crashing down.  I _think_ it might be a bit better today, I'm sure a year or two ago I saw work going into Electron for FreeBSD (from the FreeBSD side), so you might get lucky.
Menelkir seems to have some good advice!


----------



## SirDice (May 6, 2021)

If you port something that requires Electron to build or run then Electron itself has to be added to the ports tree too. You cannot have a port depending on something that's not in the ports tree. All its dependencies (build, run or library) will have to be added first.


----------



## zirias@ (May 6, 2021)

SirDice said:


> If you port something that requires Electron to build or run then Electron itself has to be added to the ports tree too.


devel/electron11 has been in the tree for quite a while now. (But still, porting electron-based stuff is a major PITA)


----------



## SirDice (May 6, 2021)

It expired though:

```
This port expired on: 2020-12-31
```


----------



## zirias@ (May 6, 2021)

This is just the typical python-2 foo and it's on the same list of exceptions as chromium… (well, for now, at least it wasn't hit by the big removal of anything requiring python-2. We will see how _that_ is going …)


----------

