1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= autoselect-perl
8 SDESC[standard]= Dynamic links to the latest installed perl
13 SPKGS[standard]= single
15 OPTIONS_AVAILABLE= none
16 OPTIONS_STANDARD= none
19 LICENSE_FILE= ISCL:{{FILESDIR}}/LICENSE_ISC
22 SUB_FILES= autoselect.c
30 ${CP} ${WRKDIR}/autoselect.c ${WRKSRC}
33 (cd ${WRKSRC} && ${CC} ${CFLAGS} ${LDFLAGS} -o generic autoselect.c)
36 .for prog in perl perl5 corelist cpan enc2xs encguess h2ph h2xs \
37 instmodsh json_pp libnetcfg perlbug perldoc perlivp perlthanks \
38 piconv pl2pm pod2html pod2man pod2text pod2usage podchecker \
39 podselect prove ptar ptardiff ptargrep shasum splain xsubpp zipdetails
40 ${INSTALL_PROGRAM} ${WRKSRC}/generic ${STAGEDIR}${PREFIX}/bin/${prog}
43 [FILE:913:descriptions/desc.single]
44 This package provides:
45 bin/perl bin/instmodsh bin/pl2pm bin/ptar
46 bin/perl5 bin/json_pp bin/pod2html bin/ptardiff
47 bin/corelist bin/libnetcfg bin/pod2man bin/ptargrep
48 bin/cpan bin/perlbug bin/pod2text bin/shasum
49 bin/enc2xs bin/perldoc bin/pod2usage bin/splain
50 bin/encguess bin/perlivp bin/podchecker bin/xsubpp
51 bin/h2ph bin/perlthanks bin/podselect bin/zipdetails
52 bin/h2xs bin/piconv bin/prove
54 It automatically selects the latest version of perl available.
55 For example, if perl 5.26 and perl 5.28 are both installed,
56 bin/perl executes bin/perl5.28 with the same arguments. If
57 perl 5.28 is then deinstalled, the linkage will automatically
60 The priority check can be overridden by setting AUTOPERL=<perl version>
61 in the environment, e.g. AUTOPERL=5.26.
64 [FILE:281:manifests/plist.single]
99 [FILE:742:files/LICENSE_ISC]
100 Copyright (c) 2018, The Ravenports Project.
102 Permission to use, copy, modify, and/or distribute this software for any
103 purpose with or without fee is hereby granted, provided that the above
104 copyright notice and this permission notice appear in all copies.
106 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
107 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
109 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
110 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
111 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
112 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
115 [FILE:2068:files/autoselect.c.in]
117 * This program will determine the latest version of perl
118 * installed by checking %%PREFIX%%/bin/perl<x> where <x> checks
119 * all possible versions.
121 * If no version is present, an error message will be displayed,
122 * otherwise the versioned counterpart of the perl command
123 * requested will be will be executed with the same arguments
124 * provided to this one. If the versioned command isn't present, an
125 * error message will be provided as a fallback.
135 main(int argc, char **argv)
140 char recommand[1024];
142 char *PERL_A = "%%PREFIX%%/bin/perl%%ALPHA_FULL%%";
143 char *PERL_B = "%%PREFIX%%/bin/perl%%BRAVO_FULL%%";
144 char *ALPHA = "%%ALPHA_FULL%%";
145 char *BRAVO = "%%BRAVO_FULL%%";
146 char *A_SHORT = "%%ALPHA%%";
147 char *B_SHORT = "%%BRAVO%%";
148 char *perl5 = "perl5";
150 override = getenv("AUTOPERL");
151 if (override != NULL) {
152 if (strcmp (override, A_SHORT) == 0) {
154 } else if (strcmp (override, B_SHORT) == 0) {
159 if (access(PERL_A, F_OK) != -1) {
161 } else if (access(PERL_B, F_OK) != -1) {
164 /* no versions of perl are installed */
165 printf ("There are no versions of perl installed at %%PREFIX%%/bin\n");
171 * Get the last path element of the program name being executed
173 cmd = strrchr(argv[0], '/');
180 * special case, cmd of perl5 transforms to perl
182 if (strcmp (cmd, perl5) == 0)
183 snprintf(recommand, 1024, "%%PREFIX%%/bin/perl%s", plver);
185 snprintf(recommand, 1024, "%%PREFIX%%/bin/%s%s", cmd, plver);
188 execv(recommand, argv);
191 * Execution failed, so write out an error message
193 printf ("Command execution failed: %s\n", recommand);
194 printf (" arguments:");
195 for (x = 1; x < argc; x++)
196 printf (" %s", argv[x]);