I built perl 5.6.0 on my Linux box yesterday. By comparing the directory
content before and after the "make", I noticed there are 22 .c files are
newly created at build time: ext/B/B.c, /ext/ByteLoader/ByteLoader.c,
ext/DB_File/DB_File.c, ext/Data/Dumper/Dumper.c, ext/Devel/DProf/DProf.c,
ext/Devel/Peek/Peek.c, ext/DynaLoader/DynaLoader.c, ext/Fcntl/Fcntl.c,
ext/File/Glob/Glob.c, ext/GDBM_File/GDBM_File.c, ext/IO/IO.c,
ext/IPC/SysV/SysV.c, etc.

I was very curious about this, so I dig into the document and found out they
are all extension interface to some system C routines. They were originally
written in XS language and came with the source package. At build time, they
are compiled by miniperl and xsubpp to output the C file:
../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp  -typemap
../../lib/ExtUtils/typemap -typemap typemap B.xs > B.xsc && mv B.xsc B.c
then the C file is compiled by gcc:
gcc -c  -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2
    -DVERSION=\"a5\" -DXS_VERSION=\"a5\" -fpic -I../..  B.c
LD_RUN_PATH="" gcc -o ../../lib/auto/B/B.so  -shared -L/usr/local/lib B.o
This discover brought me some questions: why those C files are not included
in the source tarball and have to by created at build time? are those C
files architecture and OS environment dependent? Then I did another build of
perl 5.6.0 on DEC Alpha which runs OSF1. To my surprise, those .c files
generated for DEC are the same as those generated for Linux.

Could anyone tell me why those C files are not included in the source
tarball and have to be translated from XS files during build time? given the
fact that at least for Linux and OSF, those C files are identical ? Thanks
very much.


Reply via email to