On Wed, Mar 5, 2025 at 5:28 AM Gleb Popov <[email protected]> wrote: > > On Wed, Mar 5, 2025 at 11:03 AM Igor Kolesnik <[email protected]> wrote: > > > > On Mon, Mar 03, 2025 at 08:22:12PM +0300, Gleb Popov wrote: > > > Ports are expected to locate their dependencies under the ${LOCALBASE} > > > prefix. > > > > Well, specifically, I need paths to llvm and openjdk. I can use > > > > ${LOCALBASE}/openjdk${JAVA_VERSION} > > ${LOCALBASE}/llvm > > > > or > > > > ${JAVA_HOME} > > ${LLVM_PREFIX} > > > > What approach is a preferred one? > > The latter is more canonical. You need USES=llvm:noexport to get > LLVM_PREFIX and USES=java for JAVA_HOME and other vars.
LLVM_PREFIX is defined whether the 'noexport' argument is passed to USES=llvm or not. 'noexport' just prevents setting the values of CC, CXX, and CPP. > > On Wed, Mar 5, 2025 at 12:04 PM Igor Kolesnik <[email protected]> wrote: > > > > I think, I got it. > > > > LOCALBASE is always the same, e.g. /usr/local > > LLVM_PREFIX may change > > > > If I do 'make install', LLVM_PREFIX == LOCALBASE/llvm, > > but if, for example, 'PREFIX=/opt make install' then > > LOCALBASE still /usr/local, and > > LLVM_PREFIX will be /opt/llvm > > > > Is that right? > > Not sure, because it depends on what port you're executing 'make install'. > > A probably better explanation is that PREFIX allows a user to choose > where to install a given port, while LOCALBASE specifies where all > dependencies are installed. > LOCALBASE should be adjusted globally for the whole Ports tree and all > ports should be built for the same LOCALBASE value. > A port may be installed into a PREFIX that is not equal to LOCALBASE - > it will work, but other ports won't be able to use it as a dependency. > > Specifically to your question, if you're building a port that is using > llvm, then LLVM_PREFIX will always be ${LOCALBASE}/llvm for you. > Changing PREFIX would not affect it. > I think we have a bug in Mk/llvm.mk, then. LLVM_PREFIX, semi-expanded is defined as: ${PREFIX}/llvm${_LLVM_MK_SUFFIX_${_LLVM_MK_VERSION}}, so changing PREFIX will affect that and ports using a custom PREFIX will not be able to use llvm, unless it was installed into the same custom PREFIX. Wouldn't it make more sense if in Mk/llvm.mk (L#125) _LLVM_MK_PREFIX= ${LOCALBASE}/llvm${_LLVM_MK_SUFFIX_${_LLVM_MK_VERSION} ?
