# distfiles location



## tommyhp2 (Mar 23, 2020)

Hello all,

I'm trying to get the actual distfiles location in the user environment.  I've tried ${PORTSDIR}${DISTDIR} which defaults to `/usr/ports/distfiles`.  However, in some environment like poudriere that would be different.  How do I get the distfiles location specified in the environment?

Thanks,
Tommy


----------



## SirDice (Mar 23, 2020)

In poudriere.conf:

```
# If set the given directory will be used for the distfiles
# This allows to share the distfiles between jails and ports tree
# If this is "no", poudriere must be supplied a ports tree that already has
# the required distfiles.
DISTFILES_CACHE=/usr/ports/distfiles
```


----------



## tommyhp2 (Mar 23, 2020)

Hi SirDice,

I apologize for not being clear.  I was trying to get distfiles location in the user environment from within the Makefile for a port.

Thanks,
Tommy


----------



## SirDice (Mar 24, 2020)

tommyhp2 said:


> I was trying to get distfiles location in the user environment from within the Makefile for a port.


Why? There's usually no need for this. What are you trying to do?


----------



## tommyhp2 (Mar 24, 2020)

I have the port configured to download multiple files and extract the primary for updating.  The other files need to go into 
	
	



```
${WRKSRC}/lib
```
 or 
	
	



```
${STAGEDIR}${APP_HOME}/lib
```
 for packaging.  Since I wasn't able to find in the porter's handbook on how to copy the other files nor are they in ${WRKDIR}, this is what I have to copy the files

```
post-patch:
.for file in ${DISTFILES}
.    if "${file:C/^(.*)(\:.*)/\1/}" != "${EXTRACT_ONLY}"
        ${CP} ${PORTSDIR}${DISTDIR}/${DIST_SUBDIR}/${file:C/^(.*)(\:.*)/\1/} ${WRKSRC}/lib
.    endif
.endfor
```
It errors because of file not found in poudriere due to the distfiles location is not the default `/usr/ports/distfiles`


----------

