# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= autoselect-perl VERSION= 6 REVISION= 2 KEYWORDS= lang VARIANTS= standard SDESC[standard]= Dynamic links to the latest installed perl HOMEPAGE= none CONTACT= nobody DOWNLOAD_GROUPS= none SPKGS[standard]= single OPTIONS_AVAILABLE= none OPTIONS_STANDARD= none LICENSE= ISCL:single LICENSE_FILE= ISCL:{{FILESDIR}}/LICENSE_ISC LICENSE_SCHEME= solo SUB_FILES= autoselect.c SUB_LIST= ALPHA=5.36 ALPHA_FULL=5.36.1 BRAVO=5.38 BRAVO_FULL=5.38.2 post-patch: @${MKDIR} ${WRKSRC} ${CP} ${WRKDIR}/autoselect.c ${WRKSRC} do-build: (cd ${WRKSRC} && ${CC} ${CFLAGS} ${LDFLAGS} -o generic autoselect.c) do-install: .for prog in perl perl5 corelist cpan enc2xs encguess h2ph h2xs \ instmodsh json_pp libnetcfg perlbug perldoc perlivp perlthanks \ piconv pl2pm pod2html pod2man pod2text pod2usage podchecker \ podselect prove ptar ptardiff ptargrep shasum splain xsubpp zipdetails ${INSTALL_PROGRAM} ${WRKSRC}/generic ${STAGEDIR}${PREFIX}/bin/${prog} .endfor [FILE:913:descriptions/desc.single] This package provides: bin/perl bin/instmodsh bin/pl2pm bin/ptar bin/perl5 bin/json_pp bin/pod2html bin/ptardiff bin/corelist bin/libnetcfg bin/pod2man bin/ptargrep bin/cpan bin/perlbug bin/pod2text bin/shasum bin/enc2xs bin/perldoc bin/pod2usage bin/splain bin/encguess bin/perlivp bin/podchecker bin/xsubpp bin/h2ph bin/perlthanks bin/podselect bin/zipdetails bin/h2xs bin/piconv bin/prove It automatically selects the latest version of perl available. For example, if perl 5.26 and perl 5.28 are both installed, bin/perl executes bin/perl5.28 with the same arguments. If perl 5.28 is then deinstalled, the linkage will automatically adjust to perl 5.26. The priority check can be overridden by setting AUTOPERL= in the environment, e.g. AUTOPERL=5.26. [FILE:281:manifests/plist.single] bin/ corelist cpan enc2xs encguess h2ph h2xs instmodsh json_pp libnetcfg perl perl5 perlbug perldoc perlivp perlthanks piconv pl2pm pod2html pod2man pod2text pod2usage podchecker podselect prove ptar ptardiff ptargrep shasum splain xsubpp zipdetails [FILE:742:files/LICENSE_ISC] Copyright (c) 2018, The Ravenports Project. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. [FILE:2068:files/autoselect.c.in] /* * This program will determine the latest version of perl * installed by checking %%PREFIX%%/bin/perl where checks * all possible versions. * * If no version is present, an error message will be displayed, * otherwise the versioned counterpart of the perl command * requested will be will be executed with the same arguments * provided to this one. If the versioned command isn't present, an * error message will be provided as a fallback. */ #include #include #include #include int main(int argc, char **argv) { int x; char *cmd; char *override; char recommand[1024]; char *plver = NULL; char *PERL_A = "%%PREFIX%%/bin/perl%%ALPHA_FULL%%"; char *PERL_B = "%%PREFIX%%/bin/perl%%BRAVO_FULL%%"; char *ALPHA = "%%ALPHA_FULL%%"; char *BRAVO = "%%BRAVO_FULL%%"; char *A_SHORT = "%%ALPHA%%"; char *B_SHORT = "%%BRAVO%%"; char *perl5 = "perl5"; override = getenv("AUTOPERL"); if (override != NULL) { if (strcmp (override, A_SHORT) == 0) { plver = ALPHA; } else if (strcmp (override, B_SHORT) == 0) { plver = BRAVO; } } if (plver == NULL) { if (access(PERL_A, F_OK) != -1) { plver = ALPHA; } else if (access(PERL_B, F_OK) != -1) { plver = BRAVO; } else { /* no versions of perl are installed */ printf ("There are no versions of perl installed at %%PREFIX%%/bin\n"); exit (1); } } /* * Get the last path element of the program name being executed */ cmd = strrchr(argv[0], '/'); if (cmd != NULL) cmd++; else cmd = argv[0]; /* * special case, cmd of perl5 transforms to perl */ if (strcmp (cmd, perl5) == 0) snprintf(recommand, 1024, "%%PREFIX%%/bin/perl%s", plver); else snprintf(recommand, 1024, "%%PREFIX%%/bin/%s%s", cmd, plver); argv[0] = recommand; execv(recommand, argv); /* * Execution failed, so write out an error message */ printf ("Command execution failed: %s\n", recommand); printf (" arguments:"); for (x = 1; x < argc; x++) printf (" %s", argv[x]); printf ("\n"); exit (1); }