Petr Ovtchenkov
-
2009-10-30
- assigned_to: nobody --> complement
the code in build/Makefiles/gmake/sysid.mak that tries to rip out OSNAME/ARCH from the specified tuple seems overly complicated and breaks easily on shorter tuples
first, OSNAME does:
sed 's/^[a-z0-9_]\+-[a-z0-9]\+-\([a-z]\+\).*/\1/' | sed 's/^[a-z0-9_]\+-\([a-z]\+\).*/\1/'
if we give it "i686-pc-linux-gnu", then we get back "linux" (which is correct). but if we give it "i686-linux-gnu", then we get back "gnu" (which is incorrect).
the usage of sed here seems overly fragile too considering a-z is locale dependent. perhaps a simpler bit of code would be:
awk -F- '{ if (NF > 2) NF--; print $$NF }'
same goes for M_ARCH -- you only need to split based on - and extract the first element:
awk -F- '{ print $$1 }'