@@ -194,6 +194,61 @@ $label2files{staticmulti} = +{
194194 ),
195195};
196196
197+ # mimic scheme in Archive::Unzip::Burst:
198+ # MYEXTLIB is res/lib*.a
199+ # top-level postamble deps res/unzip/Makefile off MYEXTLIB and builds res/unzip/*.o
200+ # res/M.PL overrides top_targets with:
201+ # "all : static"
202+ # "static : lib*.a"
203+ # "lib*.a : unzip/*.o -> ar makes lib*.a"
204+ # this scheme depends on top level subdirs (specifically res's "static")
205+ # being built before it tries its MYEXTLIB target
206+ $label2files {subdirsoverride } = +{
207+ %{ $label2files {' basic' } }, # make copy
208+
209+ ' Makefile.PL' => sprintf (
210+ $MAKEFILEPL , ' Test' , ' Test.pm' , qq{ '$typemap '} ,
211+ q{ DEFINE => '-DINVAR=input', MYEXTLIB => 'Other/libover$(LIB_EXT)'} ,
212+ ) . <<'EOF' ,
213+ package MY;
214+ sub postamble {
215+ my ($self) = @_;
216+ sprintf <<'MAKEFRAG', $self->cd($self->catdir(qw(Other sub)), '$(MAKE)');
217+ $(MYEXTLIB) :
218+ %s
219+ MAKEFRAG
220+ }
221+ EOF
222+
223+ ' Other/Makefile.PL' => sprintf ($MAKEFILEPL , ' Other' , ' ../Test.pm' , qq{ } , ' ' ) . <<'EOF' ,
224+ package MY;
225+ sub top_targets {
226+ <<'MAKEFRAG';
227+ all :: static
228+ static :: libover$(LIB_EXT)
229+ libover$(LIB_EXT) : sub/notmuch$(OBJ_EXT)
230+ $(AR) cr "$@" "$<"
231+ $(RANLIB) "$@"
232+ MAKEFRAG
233+ }
234+ EOF
235+
236+ ' Other/sub/Makefile.PL' => sprintf (
237+ $MAKEFILEPL , ' Third' , ' ../../Test.pm' , qq{ } , ' OBJECT => q{$(O_FILES)}'
238+ ) . <<'EOF' ,
239+ package MY;
240+ sub top_targets {
241+ <<'MAKEFRAG';
242+ all :: $(O_FILES)
243+ MAKEFRAG
244+ }
245+ EOF
246+
247+ ' Other/sub/notmuch.c' => ' ' ,
248+
249+ };
250+ virtual_rename(' subdirsoverride' , ' lib/XS/Test.pm' , ' Test.pm' );
251+
197252sub virtual_rename {
198253 my ($label , $oldfile , $newfile ) = @_ ;
199254 $label2files {$label }-> {$newfile } = delete $label2files {$label }-> {$oldfile };
@@ -234,6 +289,7 @@ sub list_dynamic {
234289 [ ' multi' , ' ' , ' ' ],
235290 [ ' staticmulti' , ' LINKTYPE=dynamic' , ' LINKTYPE=dynamic' ],
236291 [ ' staticmulti' , ' dynamic' , ' _dynamic' ],
292+ [ ' subdirsoverride' , ' ' , ' ' ],
237293 );
238294}
239295
0 commit comments