1- import useConfig from "libpkgx/hooks/useConfig.ts"
1+ import usePkgxConfig from "libpkgx/hooks/useConfig.ts"
2+ import { Config as BrewkitConfig } from "brewkit/config.ts"
23import { SupportedPlatforms , SupportedArchitectures } from "libpkgx/utils/host.ts"
34import { isArray , isString , isPlainObject , PlainObject , isPrimitive , isBoolean , isNumber } from "is-what"
45import { Package , Installation , hooks , utils , semver , Path , PantryParseError } from "libpkgx"
@@ -7,19 +8,27 @@ import undent from "outdent"
78const { validate, host } = utils
89const { useMoustaches } = hooks
910
10- export const getScript = async ( pkg : Package , key : 'build' | 'test' , deps : Installation [ ] , install_prefix : Path ) => {
11+ export const getScript = async ( pkg : Package , key : 'build' | 'test' , deps : Installation [ ] , config : BrewkitConfig ) => {
12+ const install_path = key == 'build' ? config . path . build_install : config . path . install
1113 const yml = await hooks . usePantry ( ) . project ( pkg ) . yaml ( )
1214 const node = yml [ key ]
1315
1416 const mm = useMoustaches ( )
1517 const tokens = mm . tokenize . all ( pkg , deps )
1618 tokens . push ( {
17- from : "pkgx.dir" , to : useConfig ( ) . prefix . string
19+ from : "pkgx.dir" , to : usePkgxConfig ( ) . prefix . string
1820 } )
21+ if ( key == 'build' ) {
22+ tokens . push ( {
23+ from : "srcroot" , to : config . path . build . string
24+ } , {
25+ from : "props" , to : config . path . build . join ( "props" ) . string
26+ } )
27+ }
1928
2029 for ( const [ index , token ] of tokens . entries ( ) ) {
2130 if ( token . from == "prefix" ) {
22- tokens [ index ] = { from : "prefix" , to : install_prefix . string }
31+ tokens [ index ] = { from : "prefix" , to : install_path . string }
2332 }
2433 }
2534
@@ -87,7 +96,7 @@ export const getScript = async (pkg: Package, key: 'build' | 'test', deps: Insta
8796 const rv = [ ]
8897 for ( const token of tokens ) {
8998 if ( token . from == "prefix" ) {
90- rv . push ( { from : "prefix" , to : install_prefix . string } )
99+ rv . push ( { from : "prefix" , to : install_path . string } )
91100 } else {
92101 rv . push ( token )
93102 }
0 commit comments