LMS-Community/slimserver-vendor

buildme.sh does some daft greps on FreeBSD

mnd999 opened this issue · 6 comments

buildme.sh does some greps on FreeBSD to pull the C compiler overrides out of make.conf. These greps are not safe:

        MAKE_CC=`grep CC /etc/make.conf | grep -v CCACHE | grep -v \# | sed 's#CC=##g'`
        MAKE_CXX=`grep CXX /etc/make.conf | grep -v CCACHE | grep -v \# | sed 's#CXX=##g'`
        MAKE_CPP=`grep CPP /etc/make.conf | grep -v CCACHE | grep -v \# | sed 's#CPP=##g'`

What you probably want is something like:

        MAKE_CC=`grep ^CC= /etc/make.conf | grep -v CCACHE | grep -v \# | sed 's#CC=##g'`
        MAKE_CXX=`grep ^CXX= /etc/make.conf | grep -v CCACHE | grep -v \# | sed 's#CXX=##g'`
        MAKE_CPP=`grep ^CPP= /etc/make.conf | grep -v CCACHE | grep -v \# | sed 's#CPP=##g'`

At present if you have anything containing CC in your make.conf it will screw up the build. LICENSES_ACCEPTED=SDL is a pretty common line in make.conf for building logitechmediaserver, and this will produce the following confusing output as it thinks the license line is the C compiler:

RUN_TESTS:1 CLEAN:1 USE_HINTS:1 target all
LICENSES_ACCEPTED=SDL not found - please install it

@fsbruva - could you please review the relevant changes and come up with a pull request?

@mnd999
Have you tested your proposed changes? Do you have a PR already?

No, not tested. That was off the top of my head.

Actually, perl -lne 'print $1 if /^CC=(\S+)/' would be even better (since we depend on perl, why not use it?). Unfortunately, we haven't located perl yet at this point of the script so some reordering would be required.

Created a PR - #56

This was fixed.