Page MenuHomeFreeBSD

Allow running lorder.sh on Linux
AbandonedPublic

Authored by arichardson on Aug 7 2020, 2:48 PM.

Details

Reviewers
emaste
Summary

The glibc regex implementation doesn't like the :>: expression and
therefore we end up with a syntax error due to the empty expression. Fix
this by adding quotes and a || echo 0.

Test Plan

expr now prints a warning for every dir when building on linux instead of aborting the build.

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 32840
Build 30250: arc lint + arc unit

Event Timeline

arichardson created this revision.

So this avoids failing the build, but the script does not work completely correctly?

So this avoids failing the build, but the script does not work completely correctly?

Yeah this is not the same. However, I believe lorder is no longer required with recent (> 1990) linkers+ar/ranlib that generates an index, so lorder not producing the correct order probably doesn't matter in practice (https://www.gnu.org/software/coreutils/manual/html_node/tsort-background.html)
Also: The lorder command is essentially obsolete. Use the following command in its place: % ar -ts file.a (https://www.unix.com/man-page/osf1/1/lorder/)

I also wonder if we could skip the separate ranlib step and simply use ar to simplify building of static libraries and avoid lots of forked child processes for each .a file.

lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS}
	@${ECHO} building static ${LIB} library
	@rm -f ${.TARGET}
	${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \
	    ${LORDER} ${OBJS} ${STATICOBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD}
	${RANLIB} ${RANLIBFLAGS} ${.TARGET}

->

lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS}
	@${ECHO} building static ${LIB} library
	@rm -f ${.TARGET}
	${AR} ${ARFLAGS} ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD}

If we add s to ARFLAGS.

I'm fine with this with a comment above the || echo 0 bit (i.e., a short version of what you wrote in your last Phab comment). @imp has been doing lots of Unix archaeology and might have a comment.