Makefile.include: Fix call to sed for FreeBSD and OS X [backport 2019.10] #12591
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #12435
Contribution description
Disclaimer: I'm not an expert on FreeBSD, but only stumbled upon this while using it to test another PR on a non-Linux platform and wanted to let you know.
If I didn't miss something, it looks like merging PR #12348 has broken the build on FreeBSD, as it uses
sed
's insert functionality with a syntax that is tolerated by GNU'ssed
but not by the one on FreeBSD. This PR changes the call tosed
in a way that works on both platforms.The call in question is:
From sed's manpage, we see that a backslash followed by a new line is required for the
i
command:While GNU's
sed
under Linux accepts the syntax used in PR #12348, the build with FreeBSD fails (master was on cce1438 for my tests, I also tried 3bfe30a in isolation):Using commit 3f0dfc1 (immediately before the PR was merged) was still successful on FreeBSD:
The formatting of the fix is not very nice, but using an actual line break was the only solution that allowed staying with
sed
only and worked for me independently of the host platform and shell. Something likeecho '/* ... */' | cat - $< | sed ... > $@
could be an alternative.Testing procedure
To verify that this issue exists, checkout the current master on FreeBSD, try to build an application (e.g. examples/hello_world), and see that the aforementioned error occurs:
After applying this change, the error should be gone. Also verify that the content of
<appdir>/bin/native/riotbuild/riotbuild.h
has not changed with and without the PR.Issues/PRs references
See #12348