This is a list of files handled identicaly to those in SUB_LIST except
that they are processed immediatly after WRKDIR is created. This allows
them to be used in the configure and build targets.
Details
- Reviewers
- None
- Group Reviewers
portmgr
Diff Detail
- Repository
- rP FreeBSD ports repository
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 38547 Build 35436: arc lint + arc unit
Event Timeline
I'm using this to populate a CMake toolchain file for cross building. It's tidier than doing a manual SED doing the same thing.
This sounds reasonable. Could you show the example usage (either in this diff or just add a pointer) just for reference? I'd especially like to compare the SED or REINPLACE_CMD usage to what you have with this in place. Thanks!
With this change, the following (modulo cut and paste damage) lets me cross build llvm-devel:
@@ -60,6 +63,20 @@ -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDEDIR} \ -DPYTHON_LIBRARY=${LOCALBASE}/lib/lib${PYTHON_VERSION}m.so +.if defined(CROSS_SYSROOT) +SUB_FILES_EARLY= CrossToolchain.cmake +SUB_LIST+= ARCH="${ARCH}" \ + CONFIGURE_TARGET="${CONFIGURE_TARGET}" \ + OSREL="${OSREL}" \ + SYSROOT="${CROSS_SYSROOT}" \ + CMAKE_XCC="${XCC:U${CC}}" \ + CMAKE_XCXX="${XCXX:U${CXX}}" \ + CMAKE_XLD="${XLD}" \ + CMAKE_XSTRIP_CMD="${XSTRIP_CMD:U${STRIP_CMD}}" \ + CROSS_CFLAGS="${CROSS_CFLAGS}" +CMAKE_ARGS+= -DCMAKE_TOOLCHAIN_FILE:STRING="${WRKDIR}/CrossToolchain.cmake" +.endif + # Disable assertions. They should be disabled by cmake, but USES=cmake # overrides -DCMAKE_*_FLAGS_RELEASE. CFLAGS+= -DNDEBUG
To build for riscv you'd do something like:
$ make CONFIGURE_TARGET=riscv64-portbld-freebsd13.0 TARGET=riscv64 FLAVOR=lite CROSS_SYSROOT=/home/bed22/cheri/output/sdk/sysroot-riscv64 CROSS_TOOLCHAIN=llvm11 CROSS_CFLAGS="-march=rv64imafdc -mabi=lp64d -mno-relax"
Obviously you can do this with ${SED}, but it's at lot easier to read SUB_LIST.
Mmmm, if the idea is to have the files available for configure and build, please hook them up when they are needed, in the configure stage, between configure-message and pre-configure runs, not in the extract phase.
My specific usecase is for configure, but I see no value in putting it later unless we're going to name it SUB_FILES_PRE_CONFIGURE or something.
Well, I can't figure out a reason for this to happen before the configure step, in extract, we extract stuff, in patch we patch stuff, we only start interacting with what is in WRKDIR in a more proactive manner in the configure step, so, well, it should go in the early configure stage.
I've moved apply-slist-early to configure and put it before create-binary-wrappers on the grounds that you might well want to perform substitutions in a wrapper script.
Binary wrappers, come from ports/Mk/Wrappers, there are only two of them, and they don't need that.
If stuff needs to be done in the future, it will be done, in the future. The framework is already complex, we try very hard to not introduce features nobody needs before someone needs them.
Can you please only change what is needed for your new feature?
Also, the small doc needs to be updated at the top.
Mk/bsd.port.mk | ||
---|---|---|
4539–4540 | There is no point in having an empty target. |
And now that I think about it, I wonder why not simply move apply-slist to the configure stage, there should not be any problems with having it run earlier.