kensanata / bitlbee-mastodon

A Mastodon plugin for Bitlbee
https://alexschroeder.ch/software/Bitlbee_Mastodon
GNU General Public License v2.0
30 stars 7 forks source link

Support BSD make and sed #47

Closed dougluce closed 2 years ago

dougluce commented 3 years ago

Commit bd55931 added a sed command to generate doc/HELP.md. Both the sed command and the Makefile syntax don't play well with FreeBSD's non-GNU make and sed.

BSD make doesn't recognize $<. When run, this error is produced:

/bin/sh: Syntax error: redirection unexpected (expecting word)

I changed the Makefile to instead use an explicit target.

Once that was fixed, another error showed up:

sed: 1: "1i# Bitlbee Mastodon\nT ...": command i expects \ followed by text

I believe this is due to GNU sed allowing an alternate syntax that the original sed did not. To get around this I removed the insert commands from sed and instead emit the header separately. I also switched from using a big make command to a big shell command run in a redirected subshell. I could have used multiple make commands but this way the output file only needed to be operated on once. Both command forms are fairly ugly.

The BSD make I used reports a version of 20200710 (accessible through the MAKE_VERSION Makefile variable). The sed on the system doesn't report a version. Both came as part of FreeBSD 12.2 (the latest release version).

These changes seem to work just fine on Ubuntu 18.04 (with GNU Make 4.1 and GNU sed 4.4).