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
24 SUB_FILES= autoselect.c
32 ${CP} ${WRKDIR}/autoselect.c ${WRKSRC}
35 (cd ${WRKSRC} && ${CC} ${CFLAGS} ${LDFLAGS} -o generic autoselect.c)
38 .for prog in perl perl5 corelist cpan enc2xs encguess h2ph h2xs \
39 instmodsh json_pp libnetcfg perlbug perldoc perlivp perlthanks \
40 piconv pl2pm pod2html pod2man pod2text pod2usage podchecker \
41 podselect prove ptar ptardiff ptargrep shasum splain xsubpp zipdetails
42 ${INSTALL_PROGRAM} ${WRKSRC}/generic ${STAGEDIR}${PREFIX}/bin/${prog}
45 [FILE:913:descriptions/desc.single]
46 This package provides:
47 bin/perl bin/instmodsh bin/pl2pm bin/ptar
48 bin/perl5 bin/json_pp bin/pod2html bin/ptardiff
49 bin/corelist bin/libnetcfg bin/pod2man bin/ptargrep
50 bin/cpan bin/perlbug bin/pod2text bin/shasum
51 bin/enc2xs bin/perldoc bin/pod2usage bin/splain
52 bin/encguess bin/perlivp bin/podchecker bin/xsubpp
53 bin/h2ph bin/perlthanks bin/podselect bin/zipdetails
54 bin/h2xs bin/piconv bin/prove
56 It automatically selects the latest version of perl available.
57 For example, if perl 5.26 and perl 5.28 are both installed,
58 bin/perl executes bin/perl5.28 with the same arguments. If
59 perl 5.28 is then deinstalled, the linkage will automatically
62 The priority check can be overridden by setting AUTOPERL=<perl version>
63 in the environment, e.g. AUTOPERL=5.26.
69 [FILE:281:manifests/plist.single]
104 [FILE:742:files/LICENSE_ISC]
105 Copyright (c) 2018, The Ravenports Project.
107 Permission to use, copy, modify, and/or distribute this software for any
108 purpose with or without fee is hereby granted, provided that the above
109 copyright notice and this permission notice appear in all copies.
111 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
112 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
113 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
114 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
115 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
116 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
117 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
120 [FILE:2068:files/autoselect.c.in]
122 * This program will determine the latest version of perl
123 * installed by checking %%PREFIX%%/bin/perl<x> where <x> checks
124 * all possible versions.
126 * If no version is present, an error message will be displayed,
127 * otherwise the versioned counterpart of the perl command
128 * requested will be will be executed with the same arguments
129 * provided to this one. If the versioned command isn't present, an
130 * error message will be provided as a fallback.
140 main(int argc, char **argv)
145 char recommand[1024];
147 char *PERL_A = "%%PREFIX%%/bin/perl%%ALPHA_FULL%%";
148 char *PERL_B = "%%PREFIX%%/bin/perl%%BRAVO_FULL%%";
149 char *ALPHA = "%%ALPHA_FULL%%";
150 char *BRAVO = "%%BRAVO_FULL%%";
151 char *A_SHORT = "%%ALPHA%%";
152 char *B_SHORT = "%%BRAVO%%";
153 char *perl5 = "perl5";
155 override = getenv("AUTOPERL");
156 if (override != NULL) {
157 if (strcmp (override, A_SHORT) == 0) {
159 } else if (strcmp (override, B_SHORT) == 0) {
164 if (access(PERL_A, F_OK) != -1) {
166 } else if (access(PERL_B, F_OK) != -1) {
169 /* no versions of perl are installed */
170 printf ("There are no versions of perl installed at %%PREFIX%%/bin\n");
176 * Get the last path element of the program name being executed
178 cmd = strrchr(argv[0], '/');
185 * special case, cmd of perl5 transforms to perl
187 if (strcmp (cmd, perl5) == 0)
188 snprintf(recommand, 1024, "%%PREFIX%%/bin/perl%s", plver);
190 snprintf(recommand, 1024, "%%PREFIX%%/bin/%s%s", cmd, plver);
193 execv(recommand, argv);
196 * Execution failed, so write out an error message
198 printf ("Command execution failed: %s\n", recommand);
199 printf (" arguments:");
200 for (x = 1; x < argc; x++)
201 printf (" %s", argv[x]);