Ticket #1755 (closed feature: fixed)

Opened 11 years ago

Last modified 11 years ago

Include arbitrary .c and .h files in distutils dynpmc build

Reported by: whiteknight Owned by: fperrad
Priority: normal Milestone:
Component: tools Version: 2.7.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform: all


I would like the ability to cleanly add arbitrary .c and .h files into a dynpmc library I am building using distutils. However, there is no easy way to do this. darbelo suggested a method he used for his DecNumber project where he manually compiles the .c files, and then adds the resulting .o files to the dynpmc_ldflags string to be included in linking the library. This mechanism mostly works for me, but is not without it's disadvantages:

1) We can't specify extra .h files as build prerequisites for the .pmc files. So if the .h file changes, the .pmc files won't be re-converted to C and won't be re-compiled. 2) The extra .c and .h files cannot reference the pmc_*.h files generated by pmc2c. If I compile the .c files first, the pmc_*.h files haven't been generated yet. If I compile the .c files second, I cannot link them into the dynpmc shared library, since it has already been built and linked.

I would like the ability to be able to specify a list of .c and .h files along with the list of .pmc files. I would like to be able to do something like this in my setup.nqp file:

%kv{'dynpmc'}{'mypmc_group'} := <
%kv{'dynpmc_h'}{'mypmc_group'} := <

I broke the .h files out into a separate set for illustrative purposes, but I would be perfectly happy if they were included in the same place as other files too.

Change History

Changed 11 years ago by whiteknight

  • version changed from 2.6.0 to 2.7.0

Changed 11 years ago by fperrad

Changed 11 years ago by fperrad

for 2), see  http://lists.parrot.org/pipermail/parrot-dev/attachments/20100326/e2d36d73/attachment.obj where I found a trick for Rakudo.

In prebuild(), build_dynpmc() before compile_cc() generates the pmc_*.h file needed by *.c file.

Changed 11 years ago by fperrad

  • status changed from new to closed
  • resolution set to fixed

fixed with r49086

Note: See TracTickets for help on using tickets.