Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Select the matching relocatable Perl installation. Architecture-specific
|
||||
// Config.pm and XS modules remain paired with the interpreter that built them.
|
||||
#include <mach-o/dyld.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
int main(int argc, char **argv) {
|
||||
(void)argc;
|
||||
char path[PATH_MAX], resolved[PATH_MAX]; uint32_t size = sizeof path;
|
||||
if (_NSGetExecutablePath(path, &size) || !realpath(path, resolved)) {
|
||||
perror("Cannot locate bundled Perl"); return 1;
|
||||
}
|
||||
char *last = strrchr(resolved, '/'); if (!last) return 1; *last = 0;
|
||||
last = strrchr(resolved, '/'); if (!last) return 1; *last = 0;
|
||||
#if defined(__aarch64__)
|
||||
const char *relative = "/libexec/perl/arm64/bin/perl";
|
||||
#elif defined(__x86_64__)
|
||||
const char *relative = "/libexec/perl/x86_64/bin/perl";
|
||||
#else
|
||||
#error Unsupported Perl host architecture
|
||||
#endif
|
||||
if (strlen(resolved) + strlen(relative) >= sizeof path) return 1;
|
||||
snprintf(path, sizeof path, "%s%s", resolved, relative);
|
||||
argv[0] = path;
|
||||
execv(path, argv);
|
||||
perror("Cannot execute bundled Perl"); return 1;
|
||||
}
|
||||
Reference in new issue
Block a user