New review comment by kruceter on void-packages repository https://github.com/void-linux/void-packages/pull/39583#discussion_r1064050817 Comment: My apologies for the delay. > I don't think sed would even be necessary when make_use_env wouldn't be set. cmt's makefile defines CFLAGS and CXXFLAGS with `=` which completely overrides external variables as far as I can tell. Here is what the makefile contains: ``` CFLAGS = $(INCLUDES) -Wall -Werror -O2 -fPIC CXXFLAGS = $(CFLAGS) PLUGIN_LIB = ../plugins/cmt.so ``` > But both of these approaches have a flaw: they remove the `-fPIC` flag from `CFLAGS`. That would be my fault for overlooking this. Using sed to stuff it with void's flags just because `-fPIC` is present there looks overcomplicated and unnecessary. In this case I can suggest the following (I forgot `vsed` must be used instead of `sed`): ```diff diff --git a/srcpkgs/cmt/template b/srcpkgs/cmt/template index a07ca8a069..6c676b62b9 100644 --- a/srcpkgs/cmt/template +++ b/srcpkgs/cmt/template @@ -14,9 +14,9 @@ distfiles="https://www.ladspa.org/download/${pkgname}_${version}.tgz" checksum=a82f8636de1f4ada386a199a017a9cd775a49b49e716b11e8dd3f723c93df6ca post_extract() { - sed -e "/^CFLAGS/ s/-O2/${CFLAGS}/" \ + vsed -e "s,^\(CFLAGS.*\)=,\1+=," \ -e 's|-Werror||g' \ - -i "${wrksrc}/src/Makefile" + -i "${build_wrksrc}/Makefile" } do_install() { ``` `=` is substituted with `+=`, thus making externally defined `CFLAGS` and `CXXFLAGS` usable. `make_use_env` now has its use here unlike earlier: ```markdown This build style tries to compensate for makefiles that do not respect environment variables, so well written makefiles, those that do such things as append (`+=`) to variables, should have `make_use_env` set in the body of the template. ``` With this approach only two lines have to be changed without meddling with upstream flags. > `-fPIC` could be added to `make_build_args` Based on my previous answer (I have had overlooked this flag for reasons unknown), I believe it should be left in the makefile since the fix above allows to use void's flags with those in the makefile together without that ugly hack.