@@ -65,6 +65,7 @@ my @smallmanifest = (
65
65
' __perlarchlib__/Cwd.pm' ,
66
66
' __perlarchlib__/DynaLoader.pm' ,
67
67
' __perlarchlib__/Errno.pm' ,
68
+ ' __perlarchlib__/ErrnoRuntime.pm' ,
68
69
' __perllib__/Exporter.pm' ,
69
70
' __perllib__/Exporter/Heavy.pm' ,
70
71
' __perlarchlib__/Fcntl.pm' ,
@@ -716,7 +717,7 @@ my %defconfig = (
716
717
' small' => {
717
718
desc => ' moving target: small' ,
718
719
base => ' full' ,
719
- perl_onlyextensions => [qw( Cwd Fcntl File/Glob Hash/Util IO List/Util POSIX Socket attributes re) ],
720
+ perl_onlyextensions => [qw( Cwd ErrnoRuntime Fcntl File/Glob Hash/Util IO List/Util POSIX Socket attributes re) ],
720
721
MANIFEST => \@smallmanifest ,
721
722
' include_Perl-Dist-APPerl' => 0,
722
723
dest => ' perl-small.com' ,
@@ -809,6 +810,26 @@ sub NewConfig {
809
810
_write_json(PROJECT_FILE, $projectconfig );
810
811
}
811
812
813
+ sub _install_cosmocc {
814
+ my ($SiteConfig , $version ) = @_ ;
815
+ $version //= ' 3.3.6' ;
816
+ my $cosmocc = SITE_REPO_DIR." /cosmocc" ;
817
+ print " rm -rf $cosmocc \n " ;
818
+ remove_tree($cosmocc );
819
+ print " mkdir -p $cosmocc \n " ;
820
+ make_path($cosmocc );
821
+ print " cd $cosmocc \n " ;
822
+ my $before = getcwd();
823
+ chdir ($cosmocc ) or die " Failed to chdir $cosmocc " ;
824
+ my $filename = " cosmocc-$version .zip" ;
825
+ _command_or_die(' wget' , " https://cosmo.zip/pub/cosmocc/$filename " );
826
+ _command_or_die(' unzip' , $filename );
827
+ chdir ($before ) or die " error resetting directory" ;
828
+ $SiteConfig -> {cosmocc } = $cosmocc ;
829
+ make_path(SITE_CONFIG_DIR);
830
+ _write_json(SITE_CONFIG_FILE, $SiteConfig );
831
+ }
832
+
812
833
sub InstallBuildDeps {
813
834
my ($perlrepo , $cosmorepo , $cosmocc ) = @_ ;
814
835
my $SiteConfig = _load_json(SITE_CONFIG_FILE);
@@ -945,13 +966,16 @@ sub Set {
945
966
my $itemconfig = _load_apperl_config(_load_apperl_configs()-> {apperl_configs }, $cfgname );
946
967
print Dumper($itemconfig );
947
968
if (! exists $itemconfig -> {nobuild_perl_bin }) {
948
- my $SiteConfig = _load_json(SITE_CONFIG_FILE) or die " cannot set without build deps (run apperlm install-build-deps) " ;
969
+ my $SiteConfig = _load_json(SITE_CONFIG_FILE);
949
970
if (! $itemconfig -> {cosmo3 }) {
971
+ $SiteConfig or die " cannot set without build deps (run apperlm install-build-deps)" ;
950
972
-d $SiteConfig -> {cosmo_repo } or die $SiteConfig -> {cosmo_repo } .' is not directory' ;
951
973
print " cd " .$SiteConfig -> {cosmo_repo }." \n " ;
952
974
chdir ($SiteConfig -> {cosmo_repo }) or die " Failed to enter cosmo repo" ;
953
975
_command_or_die(' git' , ' checkout' , $itemconfig -> {cosmo_id });
954
976
} else {
977
+ $SiteConfig //= {};
978
+ exists $SiteConfig -> {cosmocc } or _install_cosmocc($SiteConfig );
955
979
-d $SiteConfig -> {cosmocc } or die $SiteConfig -> {cosmocc } . ' is not a directory' ;
956
980
}
957
981
$UserProjectConfig -> {configs }{$cfgname }{perl_build_dir } //= $SiteConfig -> {perl_repo } if !$itemconfig -> {perl_url };
@@ -1031,10 +1055,10 @@ sub Configure {
1031
1055
my $perl_build_dir = $UserProjectConfig -> {configs }{$CurAPPerlName }{perl_build_dir };
1032
1056
$perl_build_dir && -d $perl_build_dir or die " $perl_build_dir is not a directory" ;
1033
1057
my $itemconfig = _load_apperl_config($Configs -> {apperl_configs }, $CurAPPerlName );
1034
- my $SiteConfig = _load_json(SITE_CONFIG_FILE) or die " cannot Configure without build deps (run apperlm install-build-deps)" ;
1035
1058
_install_perl_src_files($itemconfig , $perl_build_dir );
1036
-
1059
+ my $SiteConfig = _load_json(SITE_CONFIG_FILE);
1037
1060
if (! $itemconfig -> {cosmo3 }) {
1061
+ $SiteConfig or die " cannot Configure without build deps (run apperlm install-build-deps)" ;
1038
1062
-d $SiteConfig -> {cosmo_repo } or die $SiteConfig -> {cosmo_repo } .' is not directory' ;
1039
1063
# build toolchain
1040
1064
_command_or_die(' make' , ' -C' , $SiteConfig -> {cosmo_repo }, ' -j' , ' toolchain' , ' MODE=' , ' ARCH=x86_64' );
@@ -1050,8 +1074,10 @@ sub Configure {
1050
1074
$ENV {COSMO_APE_LOADER } = $itemconfig -> {cosmo_ape_loader };
1051
1075
$ENV {COSMO_REPO } = $SiteConfig -> {cosmo_repo };
1052
1076
} else {
1053
- -d $SiteConfig -> {cosmocc } or die $SiteConfig -> {cosmocc } . ' is not a directory' ;
1054
- $ENV {COSMOCC } = $SiteConfig -> {cosmocc };
1077
+ $SiteConfig //= {};
1078
+ exists $SiteConfig -> {cosmocc } or _install_cosmocc($SiteConfig );
1079
+ -d $SiteConfig -> {cosmocc } or die $SiteConfig -> {cosmocc } . ' is not a directory' ;
1080
+ $ENV {COSMOCC } = $SiteConfig -> {cosmocc };
1055
1081
}
1056
1082
1057
1083
# Finally Configure perl
0 commit comments