mason icon indicating copy to clipboard operation
mason copied to clipboard

mason_build: fix creating universal binary

Open lightmare opened this issue 6 years ago • 0 comments

Forewarning: I'm not doing / testing anything with this if [ "${MASON_PLATFORM}" = 'ios' ] branch, so please someone double check these changes. I've just stumbled upon it while grepping for basename which is still giving me errors, and although those errors were coming from elsewhere (as I'm running it on linux), I decided to fix this part as well.

First simple stuff, I made LIB_FOLDERS local because it seems to only be used here, and changed to += assignment because why not. (Originally I wanted to make that variable an array, but seeing how the rest of the code strongly assumes no spaces in paths, one array wouldn't change that).

Then this part:

find ${LIB_FOLDERS} -name "*.a" | xargs basename | sort | uniq

basename suitable table prints sui basename foo bar gaz fails with basename: extra operand ‘gaz’ Maybe it was meant to be xargs basename -a, but POSIX basename doesn't know -a. Luckily basename can easily be done with sed (here we don't even hit any weird cases so it's trivial).

sort | uniq is just an ancient way of saying sort -u.

And finally, this wasn't deleting anything:

rm -rf "${LIB_FOLDERS}"

lightmare avatar Aug 17 '19 17:08 lightmare