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