@@ -5,24 +5,35 @@ const { host } = utils
55
66export default async function finish ( config : Config ) {
77 const prefix = config . path . install
8- await fix_rpaths ( prefix , config . pkg , config . path . cache , config . deps . gas )
8+ const yml = await usePantry ( ) . project ( config . pkg ) . yaml ( )
9+ const skip = yml . build . skip ?? [ ]
10+ const skips = typeof skip === 'string' ? [ skip ] : skip
11+
12+ await fix_rpaths ( prefix , config . pkg , config . path . cache , config . deps . gas , skips )
913 await fix_pc_files ( prefix , config . path . build_install )
1014 await fix_cmake_files ( prefix , config . path . build_install )
11- await remove_la_files ( prefix )
15+ if ( ! skips . includes ( 'libtool-cleanup' ) ) {
16+ await remove_la_files ( prefix )
17+ } else {
18+ console . info ( `skipping libtool cleanup for ${ config . pkg . project } ` )
19+ }
1220 if ( host ( ) . platform == 'linux' ) {
1321 await consolidate_lib64 ( prefix )
1422 }
15- await flatten_headers ( prefix )
23+ if ( ! skips . includes ( 'flatten-includes' ) ) {
24+ await flatten_headers ( prefix )
25+ } else {
26+ console . info ( `skipping header flattening for ${ config . pkg . project } ` )
27+ }
1628}
1729
1830//////////////////////////////////////////////////////////////////////////////////////
19- async function fix_rpaths ( pkg_prefix : Path , pkg : Package , cache : Path , deps : Installation [ ] ) {
31+ async function fix_rpaths ( pkg_prefix : Path , pkg : Package , cache : Path , deps : Installation [ ] , skips : string [ ] ) {
2032 const bindir = new Path ( new URL ( import . meta. url ) . pathname ) . join ( "../../bin" )
21- const yml = await usePantry ( ) . project ( pkg ) . yaml ( )
2233
2334 switch ( host ( ) . platform ) {
2435 case 'darwin' : {
25- if ( yml . build . skip === 'fix-machos' || yml . build . skip ? .includes ( 'fix-machos' ) ) {
36+ if ( skips . includes ( 'fix-machos' ) ) {
2637 console . info ( `skipping rpath fixes for ${ pkg . project } ` )
2738 break
2839 }
@@ -40,7 +51,7 @@ async function fix_rpaths(pkg_prefix: Path, pkg: Package, cache: Path, deps: Ins
4051 } break
4152
4253 case 'linux' : {
43- if ( yml . build . skip === 'fix-patchelf' || yml . build . skip ? .includes ( 'fix-patchelf' ) ) {
54+ if ( skips . includes ( 'fix-patchelf' ) ) {
4455 console . info ( `skipping rpath fixes for ${ pkg . project } ` )
4556 break
4657 }
@@ -108,9 +119,11 @@ async function fix_cmake_files(pkg_prefix: Path, build_prefix: Path) {
108119
109120async function remove_la_files ( pkg_prefix : Path ) {
110121 // libtool .la files contain hardcoded paths and cause more problems than they solve
122+ // only remove top-level lib/*.la — subdirectory .la files may be module descriptors
123+ // needed at runtime (eg. ImageMagick codec plugins)
111124 const lib = pkg_prefix . join ( "lib" ) . isDirectory ( )
112125 if ( ! lib ) return
113- for await ( const [ path , { isFile } ] of lib . walk ( ) ) {
126+ for await ( const [ path , { isFile } ] of lib . ls ( ) ) {
114127 if ( isFile && path . extname ( ) == ".la" ) {
115128 console . log ( { removing : path } )
116129 Deno . removeSync ( path . string )
0 commit comments