@@ -820,8 +820,8 @@ my %defconfig = (
820820 base => ' full' ,
821821 perl_id => ' v5.44.0-RC2' ,
822822 perl_url => undef ,
823- patches => [' __sharedir__/5.44-cosmo3 .patch' ],
824- ' cosmocc-version' => ' 4.0.2 ' ,
823+ patches => [' __sharedir__/5.44-cosmo4x .patch' ],
824+ ' cosmocc-version' => ' unreleased ' ,
825825 },
826826 perl_cosmo_dev => {
827827 desc => " For developing cosmo platform perl without apperl additions" ,
@@ -921,7 +921,7 @@ sub NewConfig {
921921sub _install_cosmocc {
922922 my ($SiteConfig , $version ) = @_ ;
923923 $version //= ' 3.3.10' ;
924- my $cosmocc = SITE_REPO_DIR." /cosmocc" ;
924+ my $cosmocc = SITE_REPO_DIR." /cosmocc- $version " ;
925925 print " rm -rf $cosmocc \n " ;
926926 remove_tree($cosmocc );
927927 print " mkdir -p $cosmocc \n " ;
@@ -933,8 +933,9 @@ sub _install_cosmocc {
933933 _command_or_die(' wget' , " https://cosmo.zip/pub/cosmocc/$filename " );
934934 _command_or_die(' unzip' , $filename );
935935 chdir ($before ) or die " error resetting directory" ;
936- $SiteConfig -> {cosmocc } = $cosmocc ;
936+ $SiteConfig -> {" cosmocc- $version " } = $cosmocc ;
937937 make_path(SITE_CONFIG_DIR);
938+ delete $SiteConfig -> {cosmocc };
938939 _write_json(SITE_CONFIG_FILE, $SiteConfig );
939940}
940941
@@ -954,6 +955,7 @@ sub InstallBuildDeps {
954955 $perlrepo //= $SiteConfig -> {perl_repo };
955956 $SiteConfig -> {perl_repo } = abs_path($perlrepo );
956957 make_path(SITE_CONFIG_DIR);
958+ delete $SiteConfig -> {cosmocc };
957959 _write_json(SITE_CONFIG_FILE, $SiteConfig );
958960 print " apperlm install-build-deps: wrote site config to " .SITE_CONFIG_FILE." \n " ;
959961}
@@ -1047,7 +1049,7 @@ sub Checkout {
10471049 my $itemconfig = _load_apperl_config(_load_apperl_configs()-> {apperl_configs }, $cfgname );
10481050 print Dumper($itemconfig );
10491051 if (! exists $itemconfig -> {nobuild_perl_bin }) {
1050- my $SiteConfig = _load_valid_site_config($itemconfig -> { ' cosmocc-version ' } );
1052+ my $SiteConfig = _load_valid_site_config($itemconfig );
10511053 $UserProjectConfig -> {configs }{$cfgname }{perl_build_dir } //= $SiteConfig -> {perl_repo } if !$itemconfig -> {perl_url };
10521054 $UserProjectConfig -> {configs }{$cfgname }{perl_build_dir } //= " $UserProjectConfig ->{apperl_output}/$cfgname /tmp/perl5" ;
10531055 my $perl_build_dir = $UserProjectConfig -> {configs }{$cfgname }{perl_build_dir };
@@ -1124,7 +1126,7 @@ sub Configure {
11241126 my $perl_build_dir = $UserProjectConfig -> {configs }{$CurAPPerlName }{perl_build_dir };
11251127 $perl_build_dir && -d $perl_build_dir or die " $perl_build_dir is not a directory" ;
11261128 _install_perl_src_files($itemconfig , $perl_build_dir );
1127- my $SiteConfig = _load_valid_site_config($itemconfig -> { ' cosmocc-version ' } );
1129+ my $SiteConfig = _load_valid_site_config($itemconfig );
11281130 $ENV {COSMOCC } = $SiteConfig -> {cosmocc };
11291131
11301132 # Finally Configure perl
@@ -1168,7 +1170,7 @@ sub Build {
11681170 my @perl_config_cmd ;
11691171 # build cosmo perl if this isn't a nobuild config
11701172 if (! exists $UserProjectConfig -> {nobuild_perl_bin }){
1171- my $SiteConfig = _load_valid_site_config($itemconfig -> { ' cosmocc-version ' } );
1173+ my $SiteConfig = _load_valid_site_config($itemconfig );
11721174 my $perl_build_dir = $UserProjectConfig -> {configs }{$CurAPPerlName }{perl_build_dir };
11731175 $perl_build_dir && -d $perl_build_dir or die " $perl_build_dir is not a directory" ;
11741176 _install_perl_src_files($itemconfig , $perl_build_dir );
@@ -1753,13 +1755,15 @@ sub _load_valid_configs {
17531755}
17541756
17551757sub _load_valid_site_config {
1756- my ($cosmocc_version ) = @_ ;
1758+ my ($itemconfig ) = @_ ;
1759+ my $cosmocc_version = $itemconfig -> {' cosmocc-version' };
17571760 my $SiteConfig = _load_json(SITE_CONFIG_FILE);
17581761 $SiteConfig //= {};
1759- if (! exists $SiteConfig -> {cosmocc }) {
1762+ if (! exists $SiteConfig -> {" cosmocc- $cosmocc_version " }) {
17601763 print " cosmocc not found in " . SITE_CONFIG_FILE . " attempting to install cosmocc\n " ;
17611764 _install_cosmocc($SiteConfig , $cosmocc_version );
17621765 }
1766+ $SiteConfig -> {cosmocc } = $SiteConfig -> {" cosmocc-$cosmocc_version " };
17631767 -d $SiteConfig -> {cosmocc } or die $SiteConfig -> {cosmocc } . ' is not a directory, please edit or remove the entry in ' . SITE_CONFIG_FILE;
17641768 return $SiteConfig ;
17651769}
0 commit comments