ScriptTiger / Hosts-BL

Simple tool to handle hosts file black lists that can remove comments, remove duplicates, compress to 9 domains per line, add IPv6 entries, as well as can convert black lists to multiple other black list formats compatible with other software.
https://scripttiger.github.io/more/
MIT License
53 stars 4 forks source link

OpenBSD support #7

Open 1dotd4 opened 3 hours ago

1dotd4 commented 3 hours ago

Hello there, I do not know which package I am missing, I do not know if it is a problem of OpenBSD packaging, I just know that compiling the tool with go build hosts-bl.go gives me the following

$ go build hosts-bl.go                                                  
# command-line-arguments
./hosts-bl.go:143:43: undefined: eol
./hosts-bl.go:145:40: undefined: eol
./hosts-bl.go:147:47: undefined: eol
./hosts-bl.go:150:13: undefined: eol
./hosts-bl.go:151:17: undefined: eol
./hosts-bl.go:155:24: undefined: eol
./hosts-bl.go:156:29: undefined: eol
./hosts-bl.go:159:69: undefined: eol
./hosts-bl.go:161:31: undefined: eol
./hosts-bl.go:172:59: undefined: eol
./hosts-bl.go:172:59: too many errors

I have no clue where that eol (end-of-line) variable comes from, but adding the following (on top after the imports) fixes it for me.

const eol = "\n"

I literally use this tool once in a while to update the blacklist on unbound.

Relevant info: OpenBSD 7.6-stable, go-1.23.1.

Next steps:

Since I'm rusty with Go, if you could help with the first step, it would be very appreciated.

ScriptTiger commented 2 hours ago

Take a look at the Build.cmd. That will probably explain everything. Basically, include_windows.go should be included with Windows builds, while include_other.go should be included with everything else. go build -ldflags="-s -w" -o "Release/%file%" %app%.go %include% It's basically just creating an EOL constant internally, rather than needing to reference additional imports just for something simple. And then at build time, that constant is being defined by the appropriate include. From time to time, I also throw in additional OS-dependent constants, as well, for other projects, so it's just something I've kind of standardized internally for cross-platform Go projects.

That should explain your first two steps. As for your last step, a simple bash script replicating the build environment of the Build.cmd should suffice. I'd certainly be open to a PR if you're willing to work on that.

ScriptTiger commented 3 minutes ago

@1dotd4, I just created the Build.sh script. I'm not sure if you want to add anything.