#797: Eliminate need to expand Makefile variables in parrot_config and other
external programs
-----------------------+----------------------------------------------------
 Reporter:  jkeenan    |       Owner:  jkeenan           
     Type:  RFC        |      Status:  assigned          
 Priority:  normal     |   Milestone:                    
Component:  configure  |     Version:  1.3.0             
 Severity:  medium     |    Keywords:  configure makefile
     Lang:             |       Patch:                    
 Platform:  all        |  
-----------------------+----------------------------------------------------
Changes (by jkeenan):

  * owner:  => jkeenan
  * status:  new => assigned


Comment:

 I was able to pluck some low-hanging fruit on this ticket but have reached
 an impasse.

 Focusing strictly on Linux, I wrote this patch:
 {{{
 Index: config/init/hints/linux.pm
 ===================================================================
 --- config/init/hints/linux.pm  (revision 39830)
 +++ config/init/hints/linux.pm  (working copy)
 @@ -13,6 +13,8 @@
      my $ccflags   = $conf->option_or_data('ccflags');
      my $cc        = $conf->option_or_data('cc');
      my $linkflags = $conf->option_or_data('linkflags');
 +    my $share_ext = $conf->option_or_data('share_ext');
 +    my $version   = $conf->option_or_data('VERSION');
      my $verbose;

      $verbose = $conf->options->get('verbose');
 @@ -142,9 +144,9 @@

          has_dynamic_linking    => 1,
          parrot_is_shared       => 1,
 -        libparrot_shared       => 'libparrot$(SHARE_EXT).$(SOVERSION)',
 -        libparrot_shared_alias => 'libparrot$(SHARE_EXT)',
 -        libparrot_soname       =>
 '-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION)',
 +        libparrot_shared       => "libparrot$share_ext.$version",
 +        libparrot_shared_alias => "libparrot$share_ext",
 +        libparrot_soname       =>
 "-Wl,-soname=libparrot$share_ext.$version",
      );

       if ( ( split( m/-/, $conf->data->get_p5('archname'), 2 ) )[0] eq
 'ia64' ) {
 }}}
 In other words, I simply hard coded `$(SHARE_EXT)` and `$(SOVERSION)` and
 eliminated them as Make variables.  After running `make`, I got this diff
 of the output of ''parrot_config --dump'':
 {{{
 $ diff -w before.dump after.dump
 90c90
 < configdate => 'Mon Jun 29 11:53:51 2009 GMT'
 ---
 > configdate => 'Mon Jun 29 12:30:02 2009 GMT'
 207,209c207,209
 < libparrot_shared => 'libparrot$(SHARE_EXT).$(SOVERSION)'
 < libparrot_shared_alias => 'libparrot$(SHARE_EXT)'
 < libparrot_soname => '-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION)'
 ---
 > libparrot_shared => 'libparrot.so.1.3.0'
 > libparrot_shared_alias => 'libparrot.so'
 > libparrot_soname => '-Wl,-soname=libparrot.so.1.3.0'
 }}}
 So far, so good.  But in the above `parrot_config` still holds:
 {{{
 libparrot => '$(LIBPARROT_SHARED)'
 }}}
 ... which is set in ''config/inter/libparrot.pm'':
 {{{
     $conf->data->set(
         parrot_is_shared => $parrot_is_shared,

         libparrot => $parrot_is_shared
         ? '$(LIBPARROT_SHARED)'
         : '$(LIBPARROT_STATIC)',
 }}}
 ... and that `$(LIBPARROT_SHARED)` is needed for ''make'', as per this
 section in ''config/gen/makefiles/root.in'':
 {{{
 # Libraries
 LIBPARROT_STATIC    := @blib_dir@/@libparrot_static@
 #IF(darwin):export DYLD_LIBRARY_PATH := @blib_dir@:$(DYLD_LIBRARY_PATH)
 #IF(win32):LIBPARROT_SHARED  := @libparrot_shared@
 #ELSE:LIBPARROT_SHARED  := @blib_dir@/@libparrot_shared@

 # This line controls whether a static or shared library is built
 LIBPARROT           := @libparrot@
 }}}
 The makefile is composed by ''config/gen/makefiles.pm'', the second-to-
 last configuration step.  This config step needs certain attributes in the
 Parrot::Configure object to have been written in Makefile variable form,
 because the values of those attributes are targets within `make`.  When I
 tried to immediately expand the value of `$(LIBPARROT_SHARED)` in
 ''config/inter/libparrot.pm'', `make` failed because their was no target
 named with the expanded value.

 The problem we face now is the fact that files like ''myconfig'',
 ''lib/Parrot/Config/Generated.pm'' and ''config_lib.pasm'' are written by
 the '''very last''' configuration step, ''config/gen/config_pm.pm''.  My
 hunch is that we ultimately do not want '''any''' Makefile variables
 written to these files; we want their fully expanded forms.
 Unfortunately, `gen::config_pm` works from four template files -- 3 of
 which are coded to expect values in the `...@foo@` format characteristic of
 Makefiles.

 That suggests that ''config/gen/config_pm.pm'' is going to have to do more
 work than it does right now; that we may have to rethink the way it
 composes the files it does; and that we may have to rethink the extent to
 which we store data in the Parrot::Configure object in the form of
 Makefile variables.

 Suggestions?  Thank you very much.

 kid51

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/797#comment:2>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to