This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update metaconfig related information
[perl5.git] / Porting / pumpkin.pod
CommitLineData
aa689395
PP
1=head1 NAME
2
e25f343d 3Pumpkin - Notes on handling the Perl Patch Pumpkin And Porting Perl
aa689395
PP
4
5=head1 SYNOPSIS
6
7There is no simple synopsis, yet.
8
9=head1 DESCRIPTION
10
98dddfbd
JH
11This document attempts to begin to describe some of the considerations
12involved in patching, porting, and maintaining perl.
aa689395
PP
13
14This document is still under construction, and still subject to
15significant changes. Still, I hope parts of it will be useful,
16so I'm releasing it even though it's not done.
17
18For the most part, it's a collection of anecdotal information that
19already assumes some familiarity with the Perl sources. I really need
20an introductory section that describes the organization of the sources
21and all the various auxiliary files that are part of the distribution.
22
23=head1 Where Do I Get Perl Sources and Related Material?
24
25The Comprehensive Perl Archive Network (or CPAN) is the place to go.
26There are many mirrors, but the easiest thing to use is probably
4b05bc8e 27L<http://www.cpan.org/README.html> , which automatically points you to a
aa689395
PP
28mirror site "close" to you.
29
30=head2 Perl5-porters mailing list
31
32The mailing list perl5-porters@perl.org
33is the main group working with the development of perl. If you're
34interested in all the latest developments, you should definitely
35subscribe. The list is high volume, but generally has a
36fairly low noise level.
37
38Subscribe by sending the message (in the body of your letter)
39
40 subscribe perl5-porters
41
42to perl5-porters-request@perl.org .
43
fb73857a
PP
44Archives of the list are held at:
45
f38c94f4 46 http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/
fb73857a 47
aa689395
PP
48=head1 How are Perl Releases Numbered?
49
f5a32c7f
GS
50Beginning with v5.6.0, even versions will stand for maintenance releases
51and odd versions for development releases, i.e., v5.6.x for maintenance
52releases, and v5.7.x for development releases. Before v5.6.0, subversions
53_01 through _49 were reserved for bug-fix maintenance releases, and
54subversions _50 through _99 for unstable development versions.
7b5757d1 55
f5a32c7f
GS
56For example, in v5.6.1, the revision number is 5, the version is 6,
57and 1 is the subversion.
aa689395 58
f5a32c7f
GS
59For compatibility with the older numbering scheme the composite floating
60point version number continues to be available as the magic variable $],
76ba0908 61and amounts to C<$revision + $version/1000 + $subversion/100000>. This
f5a32c7f 62can still be used in comparisons.
aa689395 63
f5a32c7f 64 print "You've got an old perl\n" if $] < 5.005_03;
aa689395 65
f5a32c7f 66In addition, the version is also available as a string in $^V.
aa689395 67
f5a32c7f 68 print "You've got a new perl\n" if $^V and $^V ge v5.6.0;
7b5757d1 69
f5a32c7f 70You can also require particular version (or later) with:
aa689395 71
f5a32c7f 72 use 5.006;
aa689395 73
f5a32c7f 74or using the new syntax available only from v5.6 onward:
aa689395 75
f5a32c7f 76 use v5.6.0;
aa689395 77
f5a32c7f
GS
78At some point in the future, we may need to decide what to call the
79next big revision. In the .package file used by metaconfig to
80generate Configure, there are two variables that might be relevant:
81$baserev=5 and $package=perl5.
aa689395 82
f5a32c7f 83Perl releases produced by the members of perl5-porters are usually
e04b929a
GS
84available on CPAN in the F<src/5.0/maint> and F<src/5.0/devel>
85directories.
aa689395 86
7b5757d1
AD
87=head2 Maintenance and Development Subversions
88
f5a32c7f 89The first rule of maintenance work is "First, do no harm."
7b5757d1 90
fb73857a
PP
91Trial releases of bug-fix maintenance releases are announced on
92perl5-porters. Trial releases use the new subversion number (to avoid
93testers installing it over the previous release) and include a 'local
f391b661 94patch' entry in F<patchlevel.h>. The distribution file contains the
e04b929a
GS
95string C<MAINT_TRIAL> to make clear that the file is not meant for
96public consumption.
fb73857a 97
e04b929a 98In general, the names of official distribution files for the public
f5a32c7f 99always match the regular expression:
e04b929a 100
f5a32c7f 101 ^perl\d+\.(\d+)\.\d+(-MAINT_TRIAL_\d+)\.tar\.gz$
e04b929a 102
f5a32c7f
GS
103C<$1> in the pattern is always an even number for maintenance
104versions, and odd for developer releases.
e04b929a 105
efc41c8e 106In the past it has been observed that pumpkings tend to invent new
e04b929a
GS
107naming conventions on the fly. If you are a pumpking, before you
108invent a new name for any of the three types of perl distributions,
109please inform the guys from the CPAN who are doing indexing and
110provide the trees of symlinks and the like. They will have to know
111I<in advance> what you decide.
20f245af 112
aa689395
PP
113=head2 Why is it called the patch pumpkin?
114
115Chip Salzenberg gets credit for that, with a nod to his cow orker,
116David Croy. We had passed around various names (baton, token, hot
117potato) but none caught on. Then, Chip asked:
118
119[begin quote]
120
121 Who has the patch pumpkin?
122
123To explain: David Croy once told me once that at a previous job,
124there was one tape drive and multiple systems that used it for backups.
125But instead of some high-tech exclusion software, they used a low-tech
126method to prevent multiple simultaneous backups: a stuffed pumpkin.
127No one was allowed to make backups unless they had the "backup pumpkin".
128
129[end quote]
130
131The name has stuck.
132
a6968aa6 133=head1 Philosophical Issues in Patching and Porting Perl
aa689395
PP
134
135There are no absolute rules, but there are some general guidelines I
136have tried to follow as I apply patches to the perl sources.
137(This section is still under construction.)
138
139=head2 Solve problems as generally as possible
140
7b5757d1
AD
141Never implement a specific restricted solution to a problem when you
142can solve the same problem in a more general, flexible way.
143
144For example, for dynamic loading to work on some SVR4 systems, we had
145to build a shared libperl.so library. In order to build "FAT" binaries
146on NeXT 4.0 systems, we had to build a special libperl library. Rather
147than continuing to build a contorted nest of special cases, I
148generalized the process of building libperl so that NeXT and SVR4 users
149could still get their work done, but others could build a shared
150libperl if they wanted to as well.
aa689395 151
a6968aa6
JH
152Contain your changes carefully. Assume nothing about other operating
153systems, not even closely related ones. Your changes must not affect
154other platforms.
155
156Spy shamelessly on how similar patching or porting issues have been
157settled elsewhere.
158
159If feasible, try to keep filenames 8.3-compliant to humor those poor
160souls that get joy from running Perl under such dire limitations.
f391b661 161There's a script, F<check83.pl>, for keeping your nose 8.3-clean.
efc41c8e
MB
162In a similar vein, do not create files or directories which differ only
163in case (upper versus lower).
a6968aa6 164
aa689395
PP
165=head2 Seek consensus on major changes
166
167If you are making big changes, don't do it in secret. Discuss the
168ideas in advance on perl5-porters.
169
170=head2 Keep the documentation up-to-date
171
172If your changes may affect how users use perl, then check to be sure
173that the documentation is in sync with your changes. Be sure to
174check all the files F<pod/*.pod> and also the F<INSTALL> document.
175
176Consider writing the appropriate documentation first and then
7b5757d1 177implementing your change to correspond to the documentation.
aa689395
PP
178
179=head2 Avoid machine-specific #ifdef's
180
181To the extent reasonable, try to avoid machine-specific #ifdef's in
182the sources. Instead, use feature-specific #ifdef's. The reason is
183that the machine-specific #ifdef's may not be valid across major
184releases of the operating system. Further, the feature-specific tests
185may help out folks on another platform who have the same problem.
186
a6968aa6
JH
187=head2 Machine-specific files
188
98dddfbd
JH
189=over 4
190
191=item source code
192
a6968aa6 193If you have many machine-specific #defines or #includes, consider
f391b661
MS
194creating an "osish.h" (F<os2ish.h>, F<vmsish.h>, and so on) and including
195that in F<perl.h>. If you have several machine-specific files (function
a6968aa6
JH
196emulations, function stubs, build utility wrappers) you may create a
197separate subdirectory (djgpp, win32) and put the files in there.
98dddfbd 198Remember to update C<MANIFEST> when you add files.
a6968aa6 199
ff935051 200If your system supports dynamic loading but none of the existing
98dddfbd
JH
201methods at F<ext/DynaLoader/dl_*.xs> work for you, you must write
202a new one. Study the existing ones to see what kind of interface
203you must supply.
204
205=item build hints
a6968aa6
JH
206
207There are two kinds of hints: hints for building Perl and hints for
208extensions. The former live in the C<hints> subdirectory, the latter
209in C<ext/*/hints> subdirectories.
210
211The top level hints are Bourne-shell scripts that set, modify and
212unset appropriate Configure variables, based on the Configure command
213line options and possibly existing config.sh and Policy.sh files from
214previous Configure runs.
215
76ba0908 216The extension hints are written in Perl (by the time they are used
a6968aa6
JH
217miniperl has been built) and control the building of their respective
218extensions. They can be used to for example manipulate compilation
219and linking flags.
220
98dddfbd
JH
221=item build and installation Makefiles, scripts, and so forth
222
223Sometimes you will also need to tweak the Perl build and installation
224procedure itself, like for example F<Makefile.SH> and F<installperl>.
225Tread very carefully, even more than usual. Contain your changes
226with utmost care.
a6968aa6 227
98dddfbd
JH
228=item test suite
229
230Many of the tests in C<t> subdirectory assume machine-specific things
a6968aa6
JH
231like existence of certain functions, something about filesystem
232semantics, certain external utilities and their error messages. Use
233the C<$^O> and the C<Config> module (which contains the results of the
234Configure run, in effect the C<config.sh> converted to Perl) to either
98dddfbd
JH
235skip (preferably not) or customize (preferable) the tests for your
236platform.
237
238=item modules
239
240Certain standard modules may need updating if your operating system
241sports for example a native filesystem naming. You may want to update
242some or all of the modules File::Basename, File::Spec, File::Path, and
243File::Copy to become aware of your native filesystem syntax and
244peculiarities.
245
b972f109 246Remember to have a $VERSION in the modules. You can use the
f391b661 247F<Porting/checkVERSION.pl> script for checking this.
b972f109 248
98dddfbd
JH
249=item documentation
250
251If your operating system comes from outside UNIX you almost certainly
252will have differences in the available operating system functionality
253(missing system calls, different semantics, whatever). Please
254document these at F<pod/perlport.pod>. If your operating system is
255the first B<not> to have a system call also update the list of
256"portability-bewares" at the beginning of F<pod/perlfunc.pod>.
257
258A file called F<README.youros> at the top level that explains things
259like how to install perl at this platform, where to get any possibly
260required additional software, and for example what test suite errors
76ba0908
PK
261to expect, is nice too. Such files are in the process of being written
262in pod format and will eventually be renamed F<INSTALL.youros>.
98dddfbd
JH
263
264You may also want to write a separate F<.pod> file for your operating
265system to tell about existing mailing lists, os-specific modules,
266documentation, whatever. Please name these along the lines of
267F<perl>I<youros>.pod. [unfinished: where to put this file (the pod/
268subdirectory, of course: but more importantly, which/what index files
269should be updated?)]
270
271=back
a6968aa6 272
aa689395
PP
273=head2 Allow for lots of testing
274
275We should never release a main version without testing it as a
276subversion first.
277
6877a1cf
AD
278=head2 Test popular applications and modules.
279
280We should never release a main version without testing whether or not
281it breaks various popular modules and applications. A partial list of
282such things would include majordomo, metaconfig, apache, Tk, CGI,
283libnet, and libwww, to name just a few. Of course it's quite possible
284that some of those things will be just plain broken and need to be fixed,
285but, in general, we ought to try to avoid breaking widely-installed
286things.
287
98dddfbd 288=head2 Automated generation of derivative files
aa689395 289
98f8176d
SM
290The F<embed.h>, F<keywords.h>, F<opcode.h>, F<regcharclass.h>,
291F<l1_char_class_tab.h>, and F<perltoc.pod> files
aa689395
PP
292are all automatically generated by perl scripts. In general, don't
293patch these directly; patch the data files instead.
294
295F<Configure> and F<config_h.SH> are also automatically generated by
296B<metaconfig>. In general, you should patch the metaconfig units
a6968aa6
JH
297instead of patching these files directly. However, very minor changes
298to F<Configure> may be made in between major sync-ups with the
299metaconfig units, which tends to be complicated operations. But be
300careful, this can quickly spiral out of control. Running metaconfig
301is not really hard.
aa689395 302
98dddfbd
JH
303Also F<Makefile> is automatically produced from F<Makefile.SH>.
304In general, look out for all F<*.SH> files.
305
a8119d38
AD
306Finally, the sample files in the F<Porting/> subdirectory are
307generated automatically by the script F<U/mksample> included
308with the metaconfig units. See L<"run metaconfig"> below for
309information on obtaining the metaconfig units.
310
aa689395
PP
311=head1 How to Make a Distribution
312
f6af4394
DM
313This section has now been expanded and moved into its own file,
314F<Porting/release_managers_guide.pod>.
aa689395 315
47e01c32
PAR
316I've kept some of the subsections here for now, as they don't directly
317relate to building a release any more, but still contain what might be
f6af4394 318useful information - DAPM 7/2009.
05ff1fbb 319
aa689395
PP
320=head2 run metaconfig
321
322If you need to make changes to Configure or config_h.SH, it may be best to
323change the appropriate metaconfig units instead, and regenerate Configure.
324
1e436e33 325 mconfig -m -O
aa689395 326
f391b661 327will regenerate F<Configure> and F<config_h.SH>. Much more information
20f245af 328on obtaining and running metaconfig is in the F<U/README> file
1e436e33
MB
329that comes with Perl's metaconfig units. See the head of Configure for the
330recent information on how to obtain the units and the tools. The base boils
331down to
332
333` git clone github.com:perl5-metaconfig/metaconfig metaconfig
449b893f
MB
334
335Since metaconfig is hard to change, running correction scripts after
336this generation is sometimes needed. Configure gained complexity over
337time, and the order in which config_h.SH is generated can cause havoc
338when compiling perl. Therefor, you need to run Porting/config_h.pl
339after that generation. All that and more is described in the README
340files that come with the metaunits.
341
1e436e33
MB
342Alternatively, do consider if the F<*ish.h> files or the hint files might
343be a better place for your changes.
aa689395
PP
344
345=head2 MANIFEST
346
aa689395
PP
347If you are using metaconfig to regenerate Configure, then you should note
348that metaconfig actually uses MANIFEST.new, so you want to be sure
349MANIFEST.new is up-to-date too. I haven't found the MANIFEST/MANIFEST.new
350distinction particularly useful, but that's probably because I still haven't
351learned how to use the full suite of tools in the dist distribution.
352
aa689395
PP
353
354=head2 Run Configure
355
356This will build a config.sh and config.h. You can skip this if you haven't
693762b4 357changed Configure or config_h.SH at all. I use the following command
aa689395 358
693762b4
AD
359 sh Configure -Dprefix=/opt/perl -Doptimize=-O -Dusethreads \
360 -Dcf_by='yourname' \
361 -Dcf_email='yourname@yourhost.yourplace.com' \
362 -Dperladmin='yourname@yourhost.yourplace.com' \
363 -Dmydomain='.yourplace.com' \
364 -Dmyhostname='yourhost' \
365 -des
aa689395 366
693762b4 367=head2 Update Porting/config.sh and Porting/config_H
dfe9444c 368
693762b4
AD
369[XXX
370This section needs revision. We're currently working on easing
371the task of keeping the vms, win32, and plan9 config.sh info
372up-to-date. The plan is to use keep up-to-date 'canned' config.sh
373files in the appropriate subdirectories and then generate 'canned'
374config.h files for vms, win32, etc. from the generic config.sh file.
375This is to ease maintenance. When Configure gets updated, the parts
376sometimes get scrambled around, and the changes in config_H can
377sometimes be very hard to follow. config.sh, on the other hand, can
378safely be sorted, so it's easy to track (typically very small) changes
d7f8936a 379to config.sh and then propagate them to a canned 'config.h' by any
693762b4 380number of means, including a perl script in win32/ or carrying
f391b661
MS
381F<config.sh> and F<config_h.SH> to a Unix system and running sh
382config_h.SH.) Vms uses F<configure.com> to generate its own F<config.sh>
383and F<config.h>. If you want to add a new variable to F<config.sh> check
76ba0908 384with vms folk how to add it to configure.com too.
693762b4
AD
385XXX]
386
f391b661 387The F<Porting/config.sh> and F<Porting/config_H> files are provided to
693762b4 388help those folks who can't run Configure. It is important to keep
f391b661 389them up-to-date. If you have changed F<config_h.SH>, those changes must
693762b4
AD
390be reflected in config_H as well. (The name config_H was chosen to
391distinguish the file from config.h even on case-insensitive file systems.)
392Simply edit the existing config_H file; keep the first few explanatory
393lines and then copy your new config.h below.
aa689395 394
76ba0908 395It may also be necessary to update win32/config.?c, and
f391b661 396F<plan9/config.plan9>, though you should be quite careful in doing so if
aa689395
PP
397you are not familiar with those systems. You might want to issue your
398patch with a promise to quickly issue a follow-up that handles those
399directories.
400
0de566d7 401=head2 make regen_perly
aa689395 402
f391b661
MS
403If F<perly.y> has been edited, it is necessary to run this target to rebuild
404F<perly.h>, F<perly.act> and F<perly.tab>. In fact this target just runs the Perl
405script F<regen_perly.pl>. Note that F<perly.c> is I<not> rebuilt; this is just a
0de566d7 406plain static file now.
aa689395 407
0de566d7
DM
408This target relies on you having Bison installed on your system. Running
409the target will tell you if you haven't got the right version, and if so,
410where to get the right one. Or if you prefer, you could hack
f391b661 411F<regen_perly.pl> to work with your version of Bison. The important things
0de566d7 412are that the regexes can still extract out the right chunks of the Bison
f391b661
MS
413output into F<perly.act> and F<perly.tab>, and that the contents of those two
414files, plus F<perly.h>, are functionally equivalent to those produced by the
0de566d7 415supported version of Bison.
ebb99254 416
0de566d7 417Note that in the old days, you had to do C<make run_byacc> instead.
aa689395 418
76ba0908
PK
419=head2 make regen_all
420
1e2f36ef
NC
421This target takes care of the regen_headers target.
422(It used to also call the regen_pods target, but that has been eliminated.)
76ba0908 423
aa689395
PP
424=head2 make regen_headers
425
426The F<embed.h>, F<keywords.h>, and F<opcode.h> files are all automatically
427generated by perl scripts. Since the user isn't guaranteed to have a
428working perl, we can't require the user to generate them. Hence you have
429to, if you're making a distribution.
430
431I used to include rules like the following in the makefile:
432
433 # The following three header files are generated automatically
434 # The correct versions should be already supplied with the perl kit,
435 # in case you don't have perl or 'sh' available.
436 # The - is to ignore error return codes in case you have the source
437 # installed read-only or you don't have perl yet.
438 keywords.h: keywords.pl
439 @echo "Don't worry if this fails."
440 - perl keywords.pl
441
442
7b5757d1 443However, I got B<lots> of mail consisting of people worrying because the
aa689395
PP
444command failed. I eventually decided that I would save myself time
445and effort by manually running C<make regen_headers> myself rather
446than answering all the questions and complaints about the failing
447command.
448
d500e60d 449=head2 globvar.sym, and perlio.sym
aa689395
PP
450
451Make sure these files are up-to-date. Read the comments in these
f391b661 452files and in F<perl_exp.SH> to see what to do.
aa689395
PP
453
454=head2 Binary compatibility
455
d500e60d 456If you do change F<embed.fnc> think carefully about
aa689395 457what you are doing. To the extent reasonable, we'd like to maintain
76ba0908 458source and binary compatibility with older releases of perl. That way,
aa689395
PP
459extensions built under one version of perl will continue to work with
460new versions of perl.
461
462Of course, some incompatible changes may well be necessary. I'm just
463suggesting that we not make any such changes without thinking carefully
464about them first. If possible, we should provide
465backwards-compatibility stubs. There's a lot of XS code out there.
466Let's not force people to keep changing it.
467
d65aee78
SB
468=head2 PPPort
469
b2861970 470F<cpan/Devel-PPPort/PPPort.pm> needs to be synchronized to include all
f391b661 471new macros added to .h files (normally F<perl.h> and F<XSUB.h>, but others
d65aee78
SB
472as well). Since chances are that when a new macro is added the
473committer will forget to update F<PPPort.pm>, it's the best to diff for
474changes in .h files when making a new release and making sure that
475F<PPPort.pm> contains them all.
476
477The pumpking can delegate the synchronization responsibility to anybody
478else, but the release process is the only place where we can make sure
479that no new macros fell through the cracks.
480
15839b60 481
2a26e2f1
DD
482=head2 Todo
483
c3143508 484The F<Porting/todo.pod> file contains a roughly-categorized unordered
efc41c8e
MB
485list of aspects of Perl that could use enhancement, features that could
486be added, areas that could be cleaned up, and so on. During your term
487as pumpkin-holder, you will probably address some of these issues, and
488perhaps identify others which, while you decide not to address them this
489time around, may be tackled in the future. Update the file to reflect
490the situation as it stands when you hand over the pumpkin.
2a26e2f1
DD
491
492You might like, early in your pumpkin-holding career, to see if you
d7f8936a 493can find champions for particular issues on the to-do list: an issue
2a26e2f1
DD
494owned is an issue more likely to be resolved.
495
94655993 496There are also some more porting-specific L</Todo> items later in this
c4f23d77
AD
497file.
498
aa689395
PP
499=head2 OS/2-specific updates
500
501In the os2 directory is F<diff.configure>, a set of OS/2-specific
502diffs against B<Configure>. If you make changes to Configure, you may
503want to consider regenerating this diff file to save trouble for the
504OS/2 maintainer.
505
7b5757d1
AD
506You can also consider the OS/2 diffs as reminders of portability
507things that need to be fixed in Configure.
508
aa689395
PP
509=head2 VMS-specific updates
510
f391b661 511The Perl revision number appears as "perl5" in F<configure.com>.
76ba0908 512It is courteous to update that if necessary.
aa689395 513
3e3baf6d 514
aa689395
PP
515=head2 Making a new patch
516
517I find the F<makepatch> utility quite handy for making patches.
518You can obtain it from any CPAN archive under
dbcdbb63 519L<http://www.cpan.org/authors/Johan_Vromans/>. There are a couple
3e3baf6d
TB
520of differences between my version and the standard one. I have mine do
521a
aa689395
PP
522
523 # Print a reassuring "End of Patch" note so people won't
524 # wonder if their mailer truncated patches.
525 print "\n\nEnd of Patch.\n";
526
3e3baf6d
TB
527at the end. That's because I used to get questions from people asking
528if their mail was truncated.
529
530It also writes Index: lines which include the new directory prefix
531(change Index: print, approx line 294 or 310 depending on the version,
532to read: print PATCH ("Index: $newdir$new\n");). That helps patches
533work with more POSIX conformant patch programs.
aa689395
PP
534
535Here's how I generate a new patch. I'll use the hypothetical
5365.004_07 to 5.004_08 patch as an example.
537
538 # unpack perl5.004_07/
539 gzip -d -c perl5.004_07.tar.gz | tar -xof -
540 # unpack perl5.004_08/
541 gzip -d -c perl5.004_08.tar.gz | tar -xof -
542 makepatch perl5.004_07 perl5.004_08 > perl5.004_08.pat
543
544Makepatch will automatically generate appropriate B<rm> commands to remove
545deleted files. Unfortunately, it will not correctly set permissions
546for newly created files, so you may have to do so manually. For example,
547patch 5.003_04 created a new test F<t/op/gv.t> which needs to be executable,
548so at the top of the patch, I inserted the following lines:
549
550 # Make a new test
551 touch t/op/gv.t
552 chmod +x t/opt/gv.t
553
554Now, of course, my patch is now wrong because makepatch didn't know I
555was going to do that command, and it patched against /dev/null.
556
557So, what I do is sort out all such shell commands that need to be in the
558patch (including possible mv-ing of files, if needed) and put that in the
559shell commands at the top of the patch. Next, I delete all the patch parts
560of perl5.004_08.pat, leaving just the shell commands. Then, I do the
561following:
562
7b5757d1
AD
563 cd perl5.004_07
564 sh ../perl5.004_08.pat
aa689395 565 cd ..
7b5757d1 566 makepatch perl5.004_07 perl5.004_08 >> perl5.004_08.pat
aa689395
PP
567
568(Note the append to preserve my shell commands.)
569Now, my patch will line up with what the end users are going to do.
570
571=head2 Testing your patch
572
573It seems obvious, but be sure to test your patch. That is, verify that
574it produces exactly the same thing as your full distribution.
575
7b5757d1
AD
576 rm -rf perl5.004_07
577 gzip -d -c perl5.004_07.tar.gz | tar -xf -
578 cd perl5.004_07
579 sh ../perl5.004_08.pat
580 patch -p1 -N < ../perl5.004_08.pat
aa689395 581 cd ..
7b5757d1 582 gdiff -r perl5.004_07 perl5.004_08
aa689395
PP
583
584where B<gdiff> is GNU diff. Other diff's may also do recursive checking.
585
586=head2 More testing
587
588Again, it's obvious, but you should test your new version as widely as you
589can. You can be sure you'll hear about it quickly if your version doesn't
590work on both ANSI and pre-ANSI compilers, and on common systems such as
591SunOS 4.1.[34], Solaris, and Linux.
592
593If your changes include conditional code, try to test the different
594branches as thoroughly as you can. For example, if your system
595supports dynamic loading, you can also test static loading with
596
597 sh Configure -Uusedl
598
599You can also hand-tweak your config.h to try out different #ifdef
600branches.
601
d2560b70
RB
602=head2 Other tests
603
00baac8f
RGS
604=over 4
605
93189314
JH
606=item gcc -ansi -pedantic
607
608Configure -Dgccansipedantic [ -Dcc=gcc ] will enable (via the cflags script,
609not $Config{ccflags}) the gcc strict ANSI C flags -ansi and -pedantic for
610the compilation of the core files on platforms where it knows it can
611do so (like Linux, see cflags.SH for the full list), and on some
612platforms only one (Solaris can do only -pedantic, not -ansi).
613The flag -DPERL_GCC_PEDANTIC also gets added, since gcc does not add
614any internal cpp flag to signify that -pedantic is being used, as it
615does for -ansi (__STRICT_ANSI__).
616
a0426075
MB
617Note that the -ansi and -pedantic are enabled only for version 3 (and
618later) of gcc, since even gcc version 2.95.4 finds lots of seemingly
619false "value computed not used" errors from Perl.
620
93189314
JH
621The -ansi and -pedantic are useful in catching at least the following
622nonportable practices:
623
624=over 4
625
626=item *
627
628gcc-specific extensions
629
630=item *
631
632lvalue casts
633
634=item *
635
636// C++ comments
637
638=item *
639
640enum trailing commas
641
642=back
643
644The -Dgccansipedantic should be used only when cleaning up the code,
645not for production builds, since otherwise gcc cannot inline certain
646things.
647
d2560b70
RB
648=back
649
b432a672 650=head1 Common Gotchas
aa689395
PP
651
652=over 4
653
aa689395
PP
654=item Probably Prefer POSIX
655
656It's often the case that you'll need to choose whether to do
657something the BSD-ish way or the POSIX-ish way. It's usually not
658a big problem when the two systems use different names for similar
659functions, such as memcmp() and bcmp(). The perl.h header file
660handles these by appropriate #defines, selecting the POSIX mem*()
661functions if available, but falling back on the b*() functions, if
662need be.
663
664More serious is the case where some brilliant person decided to
665use the same function name but give it a different meaning or
666calling sequence :-). getpgrp() and setpgrp() come to mind.
667These are a real problem on systems that aim for conformance to
668one standard (e.g. POSIX), but still try to support the other way
669of doing things (e.g. BSD). My general advice (still not really
670implemented in the source) is to do something like the following.
671Suppose there are two alternative versions, fooPOSIX() and
672fooBSD().
673
674 #ifdef HAS_FOOPOSIX
675 /* use fooPOSIX(); */
676 #else
677 # ifdef HAS_FOOBSD
678 /* try to emulate fooPOSIX() with fooBSD();
679 perhaps with the following: */
680 # define fooPOSIX fooBSD
681 # else
682 # /* Uh, oh. We have to supply our own. */
683 # define fooPOSIX Perl_fooPOSIX
684 # endif
685 #endif
686
687=item Think positively
688
689If you need to add an #ifdef test, it is usually easier to follow if you
690think positively, e.g.
691
692 #ifdef HAS_NEATO_FEATURE
693 /* use neato feature */
694 #else
695 /* use some fallback mechanism */
696 #endif
697
698rather than the more impenetrable
699
700 #ifndef MISSING_NEATO_FEATURE
701 /* Not missing it, so we must have it, so use it */
702 #else
703 /* Are missing it, so fall back on something else. */
704 #endif
705
706Of course for this toy example, there's not much difference. But when
707the #ifdef's start spanning a couple of screen fulls, and the #else's
708are marked something like
709
710 #else /* !MISSING_NEATO_FEATURE */
711
712I find it easy to get lost.
713
714=item Providing Missing Functions -- Problem
715
716Not all systems have all the neat functions you might want or need, so
717you might decide to be helpful and provide an emulation. This is
718sound in theory and very kind of you, but please be careful about what
719you name the function. Let me use the C<pause()> function as an
720illustration.
721
722Perl5.003 has the following in F<perl.h>
723
724 #ifndef HAS_PAUSE
725 #define pause() sleep((32767<<16)+32767)
726 #endif
727
728Configure sets HAS_PAUSE if the system has the pause() function, so
729this #define only kicks in if the pause() function is missing.
730Nice idea, right?
731
732Unfortunately, some systems apparently have a prototype for pause()
733in F<unistd.h>, but don't actually have the function in the library.
734(Or maybe they do have it in a library we're not using.)
735
736Thus, the compiler sees something like
737
738 extern int pause(void);
739 /* . . . */
740 #define pause() sleep((32767<<16)+32767)
741
742and dies with an error message. (Some compilers don't mind this;
743others apparently do.)
744
745To work around this, 5.003_03 and later have the following in perl.h:
746
747 /* Some unistd.h's give a prototype for pause() even though
748 HAS_PAUSE ends up undefined. This causes the #define
749 below to be rejected by the compiler. Sigh.
750 */
751 #ifdef HAS_PAUSE
752 # define Pause pause
753 #else
754 # define Pause() sleep((32767<<16)+32767)
755 #endif
756
757This works.
758
759The curious reader may wonder why I didn't do the following in
760F<util.c> instead:
761
762 #ifndef HAS_PAUSE
763 void pause()
764 {
765 sleep((32767<<16)+32767);
766 }
767 #endif
768
769That is, since the function is missing, just provide it.
770Then things would probably be been alright, it would seem.
771
772Well, almost. It could be made to work. The problem arises from the
773conflicting needs of dynamic loading and namespace protection.
774
775For dynamic loading to work on AIX (and VMS) we need to provide a list
776of symbols to be exported. This is done by the script F<perl_exp.SH>,
d500e60d
NC
777which reads F<embed.fnc>. Thus, the C<pause>
778symbol would have to be added to F<embed.fnc> So far, so good.
aa689395
PP
779
780On the other hand, one of the goals of Perl5 is to make it easy to
781either extend or embed perl and link it with other libraries. This
782means we have to be careful to keep the visible namespace "clean".
783That is, we don't want perl's global variables to conflict with
784those in the other application library. Although this work is still
785in progress, the way it is currently done is via the F<embed.h> file.
d500e60d 786This file is built from the F<embed.fnc> file,
aa689395 787since those files already list the globally visible symbols. If we
d500e60d 788had added C<pause> to F<embed.fnc>, then F<embed.h> would contain the
aa689395
PP
789line
790
791 #define pause Perl_pause
792
793and calls to C<pause> in the perl sources would now point to
794C<Perl_pause>. Now, when B<ld> is run to build the F<perl> executable,
795it will go looking for C<perl_pause>, which probably won't exist in any
796of the standard libraries. Thus the build of perl will fail.
797
798Those systems where C<HAS_PAUSE> is not defined would be ok, however,
799since they would get a C<Perl_pause> function in util.c. The rest of
800the world would be in trouble.
801
802And yes, this scenario has happened. On SCO, the function C<chsize>
803is available. (I think it's in F<-lx>, the Xenix compatibility
804library.) Since the perl4 days (and possibly before), Perl has
805included a C<chsize> function that gets called something akin to
806
807 #ifndef HAS_CHSIZE
808 I32 chsize(fd, length)
809 /* . . . */
810 #endif
811
812When 5.003 added
813
814 #define chsize Perl_chsize
815
816to F<embed.h>, the compile started failing on SCO systems.
817
818The "fix" is to give the function a different name. The one
819implemented in 5.003_05 isn't optimal, but here's what was done:
820
821 #ifdef HAS_CHSIZE
555bd962
BG
822 # ifdef my_chsize /* Probably #defined to Perl_my_chsize */
823 # undef my_chsize /* in embed.h */
aa689395
PP
824 # endif
825 # define my_chsize chsize
826 #endif
827
828My explanatory comment in patch 5.003_05 said:
829
555bd962
BG
830 Undef and then re-define my_chsize from Perl_my_chsize to
831 just plain chsize if this system HAS_CHSIZE. This probably only
832 applies to SCO. This shows the perils of having internal
833 functions with the same name as external library functions :-).
aa689395 834
d500e60d 835Now, we can safely put C<my_chsize> in C<embed.fnc>, export it, and
aa689395
PP
836hide it with F<embed.h>.
837
838To be consistent with what I did for C<pause>, I probably should have
839called the new function C<Chsize>, rather than C<my_chsize>.
840However, the perl sources are quite inconsistent on this (Consider
841New, Mymalloc, and Myremalloc, to name just a few.)
842
843There is a problem with this fix, however, in that C<Perl_chsize>
844was available as a F<libperl.a> library function in 5.003, but it
845isn't available any more (as of 5.003_07). This means that we've
846broken binary compatibility. This is not good.
847
848=item Providing missing functions -- some ideas
849
850We currently don't have a standard way of handling such missing
851function names. Right now, I'm effectively thinking aloud about a
852solution. Some day, I'll try to formally propose a solution.
853
854Part of the problem is that we want to have some functions listed as
855exported but not have their names mangled by embed.h or possibly
856conflict with names in standard system headers. We actually already
857have such a list at the end of F<perl_exp.SH> (though that list is
858out-of-date):
859
860 # extra globals not included above.
861 cat <<END >> perl.exp
862 perl_init_ext
863 perl_init_fold
864 perl_init_i18nl14n
865 perl_alloc
866 perl_construct
867 perl_destruct
868 perl_free
869 perl_parse
870 perl_run
871 perl_get_sv
872 perl_get_av
873 perl_get_hv
874 perl_get_cv
875 perl_call_argv
876 perl_call_pv
877 perl_call_method
878 perl_call_sv
879 perl_requirepv
880 safecalloc
881 safemalloc
882 saferealloc
883 safefree
884
885This still needs much thought, but I'm inclined to think that one
886possible solution is to prefix all such functions with C<perl_> in the
887source and list them along with the other C<perl_*> functions in
888F<perl_exp.SH>.
889
890Thus, for C<chsize>, we'd do something like the following:
891
892 /* in perl.h */
893 #ifdef HAS_CHSIZE
894 # define perl_chsize chsize
895 #endif
896
897then in some file (e.g. F<util.c> or F<doio.c>) do
898
899 #ifndef HAS_CHSIZE
900 I32 perl_chsize(fd, length)
901 /* implement the function here . . . */
902 #endif
903
904Alternatively, we could just always use C<chsize> everywhere and move
d500e60d 905C<chsize> from F<embed.fnc> to the end of F<perl_exp.SH>. That would
aa689395
PP
906probably be fine as long as our C<chsize> function agreed with all the
907C<chsize> function prototypes in the various systems we'll be using.
908As long as the prototypes in actual use don't vary that much, this is
909probably a good alternative. (As a counter-example, note how Configure
910and perl have to go through hoops to find and use get Malloc_t and
911Free_t for C<malloc> and C<free>.)
912
913At the moment, this latter option is what I tend to prefer.
914
915=item All the world's a VAX
916
917Sorry, showing my age:-). Still, all the world is not BSD 4.[34],
918SVR4, or POSIX. Be aware that SVR3-derived systems are still quite
919common (do you have any idea how many systems run SCO?) If you don't
920have a bunch of v7 manuals handy, the metaconfig units (by default
921installed in F</usr/local/lib/dist/U>) are a good resource to look at
922for portability.
923
924=back
925
926=head1 Miscellaneous Topics
927
928=head2 Autoconf
929
930Why does perl use a metaconfig-generated Configure script instead of an
931autoconf-generated configure script?
932
933Metaconfig and autoconf are two tools with very similar purposes.
934Metaconfig is actually the older of the two, and was originally written
935by Larry Wall, while autoconf is probably now used in a wider variety of
936packages. The autoconf info file discusses the history of autoconf and
937how it came to be. The curious reader is referred there for further
938information.
939
940Overall, both tools are quite good, I think, and the choice of which one
941to use could be argued either way. In March, 1994, when I was just
942starting to work on Configure support for Perl5, I considered both
943autoconf and metaconfig, and eventually decided to use metaconfig for the
944following reasons:
945
946=over 4
947
948=item Compatibility with Perl4
949
950Perl4 used metaconfig, so many of the #ifdef's were already set up for
951metaconfig. Of course metaconfig had evolved some since Perl4's days,
952but not so much that it posed any serious problems.
953
954=item Metaconfig worked for me
955
d1be9408 956My system at the time was Interactive 2.2, an SVR3.2/386 derivative that
aa689395
PP
957also had some POSIX support. Metaconfig-generated Configure scripts
958worked fine for me on that system. On the other hand, autoconf-generated
959scripts usually didn't. (They did come quite close, though, in some
960cases.) At the time, I actually fetched a large number of GNU packages
961and checked. Not a single one configured and compiled correctly
962out-of-the-box with the system's cc compiler.
963
964=item Configure can be interactive
965
966With both autoconf and metaconfig, if the script works, everything is
967fine. However, one of my main problems with autoconf-generated scripts
968was that if it guessed wrong about something, it could be B<very> hard to
969go back and fix it. For example, autoconf always insisted on passing the
970-Xp flag to cc (to turn on POSIX behavior), even when that wasn't what I
971wanted or needed for that package. There was no way short of editing the
972configure script to turn this off. You couldn't just edit the resulting
973Makefile at the end because the -Xp flag influenced a number of other
974configure tests.
975
976Metaconfig's Configure scripts, on the other hand, can be interactive.
977Thus if Configure is guessing things incorrectly, you can go back and fix
978them. This isn't as important now as it was when we were actively
979developing Configure support for new features such as dynamic loading,
980but it's still useful occasionally.
981
982=item GPL
983
984At the time, autoconf-generated scripts were covered under the GNU Public
985License, and hence weren't suitable for inclusion with Perl, which has a
986different licensing policy. (Autoconf's licensing has since changed.)
987
988=item Modularity
989
990Metaconfig builds up Configure from a collection of discrete pieces
991called "units". You can override the standard behavior by supplying your
992own unit. With autoconf, you have to patch the standard files instead.
993I find the metaconfig "unit" method easier to work with. Others
994may find metaconfig's units clumsy to work with.
995
996=back
997
aa689395
PP
998=head2 Why isn't there a directory to override Perl's library?
999
1000Mainly because no one's gotten around to making one. Note that
1001"making one" involves changing perl.c, Configure, config_h.SH (and
1002associated files, see above), and I<documenting> it all in the
1003INSTALL file.
1004
1005Apparently, most folks who want to override one of the standard library
1006files simply do it by overwriting the standard library files.
1007
1008=head2 APPLLIB
1009
1010In the perl.c sources, you'll find an undocumented APPLLIB_EXP
1011variable, sort of like PRIVLIB_EXP and ARCHLIB_EXP (which are
1012documented in config_h.SH). Here's what APPLLIB_EXP is for, from
1013a mail message from Larry:
1014
1015 The main intent of APPLLIB_EXP is for folks who want to send out a
555bd962
BG
1016 version of Perl embedded in their product. They would set the
1017 symbol to be the name of the library containing the files needed
1018 to run or to support their particular application. This works at
1019 the "override" level to make sure they get their own versions of
1020 any library code that they absolutely must have configuration
1021 control over.
aa689395
PP
1022
1023 As such, I don't see any conflict with a sysadmin using it for a
555bd962
BG
1024 override-ish sort of thing, when installing a generic Perl. It
1025 should probably have been named something to do with overriding
1026 though. Since it's undocumented we could still change it... :-)
aa689395 1027
24f415b4
AD
1028Given that it's already there, you can use it to override distribution modules.
1029One way to do that is to add
1030
453a1e5f 1031 ccflags="$ccflags -DAPPLLIB_EXP=\"/my/override\""
a4b0381d 1032
24f415b4 1033to your config.over file. (You have to be particularly careful to get the
453a1e5f
MB
1034double quotes in. APPLLIB_EXP must be a valid C string. It might
1035actually be easier to just #define it yourself in perl.c.)
24f415b4
AD
1036
1037Then perl.c will put /my/override ahead of ARCHLIB and PRIVLIB. Perl will
1038also search architecture-specific and version-specific subdirectories of
1039APPLLIB_EXP.
aa689395 1040
c4f23d77
AD
1041=head2 Shared libperl.so location
1042
1043Why isn't the shared libperl.so installed in /usr/lib/ along
1044with "all the other" shared libraries? Instead, it is installed
1045in $archlib, which is typically something like
1046
1047 /usr/local/lib/perl5/archname/5.00404
1048
1049and is architecture- and version-specific.
1050
1051The basic reason why a shared libperl.so gets put in $archlib is so that
1052you can have more than one version of perl on the system at the same time,
1053and have each refer to its own libperl.so.
1054
1055Three examples might help. All of these work now; none would work if you
1056put libperl.so in /usr/lib.
1057
1058=over
1059
1060=item 1.
1061
1062Suppose you want to have both threaded and non-threaded perl versions
1063around. Configure will name both perl libraries "libperl.so" (so that
1064you can link to them with -lperl). The perl binaries tell them apart
1065by having looking in the appropriate $archlib directories.
1066
1067=item 2.
1068
1069Suppose you have perl5.004_04 installed and you want to try to compile
1070it again, perhaps with different options or after applying a patch.
1071If you already have libperl.so installed in /usr/lib/, then it may be
1072either difficult or impossible to get ld.so to find the new libperl.so
1073that you're trying to build. If, instead, libperl.so is tucked away in
1074$archlib, then you can always just change $archlib in the current perl
1075you're trying to build so that ld.so won't find your old libperl.so.
1076(The INSTALL file suggests you do this when building a debugging perl.)
1077
1078=item 3.
1079
1080The shared perl library is not a "well-behaved" shared library with
1081proper major and minor version numbers, so you can't necessarily
1082have perl5.004_04 and perl5.004_05 installed simultaneously. Suppose
1083perl5.004_04 were to install /usr/lib/libperl.so.4.4, and perl5.004_05
1084were to install /usr/lib/libperl.so.4.5. Now, when you try to run
1085perl5.004_04, ld.so might try to load libperl.so.4.5, since it has
1086the right "major version" number. If this works at all, it almost
1087certainly defeats the reason for keeping perl5.004_04 around. Worse,
47e01c32 1088with development subversions, you certainly can't guarantee that
c4f23d77
AD
1089libperl.so.4.4 and libperl.so.4.55 will be compatible.
1090
1091Anyway, all this leads to quite obscure failures that are sure to drive
1092casual users crazy. Even experienced users will get confused :-). Upon
1093reflection, I'd say leave libperl.so in $archlib.
1094
94655993
SR
1095=back
1096
1097=head2 Indentation style
2032ff04 1098
94655993 1099Over the years Perl has become a mishmash of
2032ff04
JH
1100various indentation styles, but the original "Larry style" can
1101probably be restored with (GNU) indent somewhat like this:
1102
1103 indent -kr -nce -psl -sc
1104
55c0ed8c
JH
1105A more ambitious solution would also specify a list of Perl specific
1106types with -TSV -TAV -THV .. -TMAGIC -TPerlIO ... but that list would
1107be quite ungainly. Also note that GNU indent also doesn't do aligning
1108of consecutive assignments, which would truly wreck the layout in
1109places like sv.c:Perl_sv_upgrade() or sv.c:Perl_clone_using().
1110Similarly nicely aligned &&s, ||s and ==s would not be respected.
2032ff04 1111
aa689395
PP
1112=head1 Upload Your Work to CPAN
1113
1114You can upload your work to CPAN if you have a CPAN id. Check out
f391b661 1115L<http://www.cpan.org/modules/04pause.html> for information on
aa689395
PP
1116_PAUSE_, the Perl Author's Upload Server.
1117
1118I typically upload both the patch file, e.g. F<perl5.004_08.pat.gz>
1119and the full tar file, e.g. F<perl5.004_08.tar.gz>.
1120
1121If you want your patch to appear in the F<src/5.0/unsupported>
1122directory on CPAN, send e-mail to the CPAN master librarian. (Check
4b05bc8e 1123out L<http://www.cpan.org/CPAN.html> ).
aa689395
PP
1124
1125=head1 Help Save the World
1126
1127You should definitely announce your patch on the perl5-porters list.
aa689395
PP
1128
1129=head1 Todo
1130
1131Here, in no particular order, are some Configure and build-related
1132items that merit consideration. This list isn't exhaustive, it's just
1133what I came up with off the top of my head.
1134
e25f343d
PG
1135=head2 Adding missing library functions to Perl
1136
1137The perl Configure script automatically determines which headers and
1138functions you have available on your system and arranges for them to be
1139included in the compilation and linking process. Occasionally, when porting
1140perl to an operating system for the first time, you may find that the
1141operating system is missing a key function. While perl may still build
1142without this function, no perl program will be able to reference the missing
1143function. You may be able to write the missing function yourself, or you
1144may be able to find the missing function in the distribution files for
1145another software package. In this case, you need to instruct the perl
1146configure-and-build process to use your function. Perform these steps.
1147
1148=over 3
1149
1150=item *
1151
2ecb232b 1152Code and test the function you wish to add. Test it carefully; you will
e25f343d
PG
1153have a much easier time debugging your code independently than when it is a
1154part of perl.
1155
1156=item *
1157
1158Here is an implementation of the POSIX truncate function for an operating
1159system (VOS) that does not supply one, but which does supply the ftruncate()
1160function.
1161
1162 /* Beginning of modification history */
1163 /* Written 02-01-02 by Nick Ing-Simmons (nick@ing-simmons.net) */
1164 /* End of modification history */
f703fc96 1165
e25f343d
PG
1166 /* VOS doesn't supply a truncate function, so we build one up
1167 from the available POSIX functions. */
f703fc96 1168
e25f343d
PG
1169 #include <fcntl.h>
1170 #include <sys/types.h>
1171 #include <unistd.h>
f703fc96 1172
e25f343d
PG
1173 int
1174 truncate(const char *path, off_t len)
1175 {
1176 int fd = open(path,O_WRONLY);
1177 int code = -1;
1178 if (fd >= 0) {
1179 code = ftruncate(fd,len);
1180 close(fd);
1181 }
1182 return code;
1183 }
1184
1185Place this file into a subdirectory that has the same name as the operating
1186system. This file is named perl/vos/vos.c
1187
1188=item *
1189
1190If your operating system has a hints file (in perl/hints/XXX.sh for an
1191operating system named XXX), then start with it. If your operating system
1192has no hints file, then create one. You can use a hints file for a similar
1193operating system, if one exists, as a template.
1194
1195=item *
1196
1197Add lines like the following to your hints file. The first line
1198(d_truncate="define") instructs Configure that the truncate() function
1199exists. The second line (archobjs="vos.o") instructs the makefiles that the
1200perl executable depends on the existence of a file named "vos.o". (Make
1201will automatically look for "vos.c" and compile it with the same options as
1202the perl source code). The final line ("test -h...") adds a symbolic link
1203to the top-level directory so that make can find vos.c. Of course, you
1204should use your own operating system name for the source file of extensions,
1205not "vos.c".
1206
1207 # VOS does not have truncate() but we supply one in vos.c
1208 d_truncate="define"
1209 archobjs="vos.o"
f703fc96 1210
e25f343d
PG
1211 # Help gmake find vos.c
1212 test -h vos.c || ln -s vos/vos.c vos.c
1213
1214The hints file is a series of shell commands that are run in the top-level
1215directory (the "perl" directory). Thus, these commands are simply executed
1216by Configure at an appropriate place during its execution.
1217
1218=item *
1219
1220At this point, you can run the Configure script and rebuild perl. Carefully
1221test the newly-built perl to ensure that normal paths, and error paths,
1222behave as you expect.
1223
1224=back
1225
aa689395
PP
1226=head2 Good ideas waiting for round tuits
1227
1228=over 4
1229
c4f23d77 1230=item Configure -Dsrc=/blah/blah
aa689395
PP
1231
1232We should be able to emulate B<configure --srcdir>. Tom Tromey
1233tromey@creche.cygnus.com has submitted some patches to
c4f23d77
AD
1234the dist-users mailing list along these lines. They have been folded
1235back into the main distribution, but various parts of the perl
1236Configure/build/install process still assume src='.'.
aa689395
PP
1237
1238=item Hint file fixes
1239
1240Various hint files work around Configure problems. We ought to fix
1241Configure so that most of them aren't needed.
1242
1243=item Hint file information
1244
1245Some of the hint file information (particularly dynamic loading stuff)
1246ought to be fed back into the main metaconfig distribution.
1247
1248=back
1249
1250=head2 Probably good ideas waiting for round tuits
1251
1252=over 4
1253
1254=item GNU configure --options
1255
1256I've received sensible suggestions for --exec_prefix and other
1257GNU configure --options. It's not always obvious exactly what is
1258intended, but this merits investigation.
1259
aa689395
PP
1260=item Try gcc if cc fails
1261
1262Currently, we just give up.
1263
1264=item bypassing safe*alloc wrappers
1265
1266On some systems, it may be safe to call the system malloc directly
1267without going through the util.c safe* layers. (Such systems would
1268accept free(0), for example.) This might be a time-saver for systems
1269that already have a good malloc. (Recent Linux libc's apparently have
1270a nice malloc that is well-tuned for the system.)
1271
1272=back
1273
1274=head2 Vague possibilities
1275
1276=over 4
1277
aa689395
PP
1278=item gconvert replacement
1279
1280Maybe include a replacement function that doesn't lose data in rare
1281cases of coercion between string and numerical values.
1282
aa689395
PP
1283=item Improve makedepend
1284
1285The current makedepend process is clunky and annoyingly slow, but it
1286works for most folks. Alas, it assumes that there is a filename
1287$firstmakefile that the B<make> command will try to use before it uses
1288F<Makefile>. Such may not be the case for all B<make> commands,
1289particularly those on non-Unix systems.
1290
1291Probably some variant of the BSD F<.depend> file will be useful.
1292We ought to check how other packages do this, if they do it at all.
1293We could probably pre-generate the dependencies (with the exception of
1294malloc.o, which could probably be determined at F<Makefile.SH>
1295extraction time.
1296
1297=item GNU Makefile standard targets
1298
1299GNU software generally has standardized Makefile targets. Unless we
1300have good reason to do otherwise, I see no reason not to support them.
1301
1302=item File locking
1303
1304Somehow, straighten out, document, and implement lockf(), flock(),
76ba0908
PK
1305and/or fcntl() file locking. It's a mess. See $d_fcntl_can_lock
1306in recent config.sh files though.
aa689395
PP
1307
1308=back
1309
4bb101f2
JH
1310=head2 Copyright Issues
1311
1312The following is based on the consensus of a couple of IPR lawyers,
1313but it is of course not a legally binding statement, just a common
1314sense summary.
1315
1316=over 4
1317
1318=item *
1319
1320Tacking on copyright statements is unnecessary to begin with because
1321of the Berne convention. But assuming you want to go ahead...
1322
1323=item *
1324
1325The right form of a copyright statement is
1326
1327 Copyright (C) Year, Year, ... by Someone
1328
1329The (C) is not required everywhere but it doesn't hurt and in certain
1330jurisdictions it is required, so let's leave it in. (Yes, it's true
1331that in some jurisdictions the "(C)" is not legally binding, one should
1332use the true ringed-C. But we don't have that character available for
1333Perl's source code.)
1334
1335The years must be listed out separately. Year-Year is not correct.
1336Only the years when the piece has changed 'significantly' may be added.
1337
1338=item *
1339
1340One cannot give away one's copyright trivially. One can give one's
1341copyright away by using public domain, but even that requires a little
1342bit more than just saying 'this is in public domain'. (What it
1343exactly requires depends on your jurisdiction.) But barring public
1344domain, one cannot "transfer" one's copyright to another person or
1345entity. In the context of software, it means that contributors cannot
1346give away their copyright or "transfer" it to the "owner" of the software.
1347
1348Also remember that in many cases if you are employed by someone,
1349your work may be copyrighted to your employer, even when you are
1350contributing on your own time (this all depends on too many things
1351to list here). But the bottom line is that you definitely can't give
1352away a copyright you may not even have.
1353
1354What is possible, however, is that the software can simply state
1355
1356 Copyright (C) Year, Year, ... by Someone and others
1357
1358and then list the "others" somewhere in the distribution.
1359And this is exactly what Perl does. (The "somewhere" is
1360AUTHORS and the Changes* files.)
1361
1362=item *
1363
1364Split files, merged files, and generated files are problematic.
1365The rule of thumb: in split files, copy the copyright years of
1366the original file to all the new files; in merged files make
1367an union of the copyright years of all the old files; in generated
1368files propagate the copyright years of the generating file(s).
1369
1370=item *
1371
1372The files of Perl source code distribution do carry a lot of
1373copyrights, by various people. (There are many copyrights embedded in
1374perl.c, for example.) The most straightforward thing for pumpkings to
1375do is to simply update Larry's copyrights at the beginning of the
c67aee7a 1376*.[hcy], *.pl, and README files, and leave all other
4bb101f2
JH
1377copyrights alone. Doing more than that requires quite a bit of tracking.
1378
1379=back
1380
fb73857a 1381=head1 AUTHORS
aa689395 1382
36816da2 1383Original author: Andy Dougherty doughera@lafayette.edu .
1e436e33
MB
1384Additions by Chip Salzenberg chip@perl.com, Tim Bunce and the perl5
1385development team.
aa689395
PP
1386
1387All opinions expressed herein are those of the authorZ<>(s).
1388
1389=head1 LAST MODIFIED
1390
1e436e33 13912017-10-13 H.Merijn Brand