Skip to content

Commit 79a28e3

Browse files
committed
make $^X more reliable, set $Config{perlpath} to $^X
1 parent be520b6 commit 79a28e3

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

Changes

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ v0.6.0 2024-05-XX
1616
maintained essentially seperately.
1717
Remove most of the versioned configs, they were far behind the
1818
rolling release / unnamed builds and often changed with them.
19+
Make $^X more reliable by using Cosmos's GetProgramExecutableName
20+
Set $Config{perlpath} to $^X (GH#6)
1921

2022
v0.5.0 2024-03-21
2123
Revert `full` and `small` targets with cosmo 3.0.2

share/5.36-cosmo3.patch

+47-5
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,49 @@ index 0000000000..e5b5de8952
266266
+The port in-progress is being done by Gavin Hayes <[email protected]>
267267
+
268268
+Last update: 2022-10-11
269+
diff --git a/caretx.c b/caretx.c
270+
index 3d11877037..211a2e89a7 100644
271+
--- a/caretx.c
272+
+++ b/caretx.c
273+
@@ -40,6 +40,10 @@
274+
# include <mach-o/dyld.h>
275+
#endif
276+
277+
+#if defined(__COSMOPOLITAN__)
278+
+# include "libc/cosmo.h"
279+
+#endif
280+
+
281+
void
282+
Perl_set_caret_X(pTHX) {
283+
GV* tmpgv = gv_fetchpvs("\030", GV_ADD|GV_NOTQUAL, SVt_PV); /* $^X */
284+
@@ -55,6 +59,9 @@ Perl_set_caret_X(pTHX) {
285+
sv_setpv(caret_x, ansi);
286+
win32_free(ansi);
287+
return;
288+
+#elif defined(__COSMOPOLITAN__)
289+
+ sv_setpv(caret_x, GetProgramExecutableName());
290+
+ return;
291+
#else
292+
/* We can try a platform-specific one if possible; if it fails, or we
293+
* aren't running on a suitable platform, we'll fall back to argv[0]. */
294+
diff --git a/configpm b/configpm
295+
index 94a4778037..2f7ab82600 100755
296+
--- a/configpm
297+
+++ b/configpm
298+
@@ -585,6 +585,13 @@ $heavy_txt .= join('',
299+
} @v_others, @v_forced
300+
) . "!END!\n";
301+
302+
+if ($^O eq 'cosmo') {
303+
+$heavy_txt .= <<'EOT';
304+
+
305+
+s/perlpath=.+/perlpath='$^X'/;
306+
+EOT
307+
+}
308+
+
309+
# Only need the dynamic byteorder code in Config.pm if 'byteorder' is one of
310+
# the precached keys
311+
if ($Common{byteorder}) {
269312
diff --git a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm
270313
index 0aee5233fe..cd17c1c86f 100644
271314
--- a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm
@@ -481,23 +524,22 @@ index 6a7f03c289..38844079d0 100644
481524
# endif /* OS2 */
482525
# endif /* WIN32 */
483526
diff --git a/doio.c b/doio.c
484-
index f0d451af3c..63dce797fa 100644
527+
index f0d451af3c..c7e76d0512 100644
485528
--- a/doio.c
486529
+++ b/doio.c
487-
@@ -55,6 +55,12 @@
530+
@@ -55,6 +55,11 @@
488531
# define OPEN_EXCL 0
489532
#endif
490533

491534
+#ifdef __COSMOPOLITAN__
492-
+# define _COSMO_SOURCE
493535
+# include "libc/dce.h"
494-
+ void __paginate_file(int fd, const char *s);
536+
+# include "libc/runtime/runtime.h"
495537
+#endif
496538
+
497539
#define PERL_MODE_MAX 8
498540
#define PERL_FLAGS_MAX 10
499541

500-
@@ -2512,7 +2518,24 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
542+
@@ -2512,7 +2517,24 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
501543
}
502544
doshell:
503545
PERL_FPU_PRE_EXEC

0 commit comments

Comments
 (0)