@@ -4,18 +4,26 @@ import {builtinLlamaCppGitHubRepo, builtinLlamaCppRelease} from "../../config.js
44
55export async function getBuildFolderNameForBuildOptions ( buildOptions : BuildOptions ) {
66 const nameParts : string [ ] = [ buildOptions . platform , buildOptions . arch ] ;
7+ const binParts : string [ ] = [ ] ;
78
8- if ( buildOptions . gpu !== false )
9+ if ( buildOptions . gpu !== false ) {
910 nameParts . push ( makeStringSafeForPathName ( buildOptions . gpu ) ) ;
11+ binParts . push ( makeStringSafeForPathName ( buildOptions . gpu . toLowerCase ( ) ) ) ;
12+ }
1013
11- if ( buildOptions . llamaCpp . repo !== builtinLlamaCppGitHubRepo || buildOptions . llamaCpp . release !== builtinLlamaCppRelease )
12- nameParts . push ( "release-" + await getFolderNamePartForRelease ( buildOptions . llamaCpp . repo , buildOptions . llamaCpp . release ) ) ;
14+ if ( buildOptions . llamaCpp . repo !== builtinLlamaCppGitHubRepo || buildOptions . llamaCpp . release !== builtinLlamaCppRelease ) {
15+ const releaseFolderNamePart = await getFolderNamePartForRelease ( buildOptions . llamaCpp . repo , buildOptions . llamaCpp . release ) ;
16+ nameParts . push ( "release-" + releaseFolderNamePart ) ;
17+ binParts . push ( releaseFolderNamePart . replaceAll ( " " , "_" ) ) ;
18+ } else if ( buildOptions . llamaCpp . release !== "latest" )
19+ binParts . push ( buildOptions . llamaCpp . release ) ;
1320
1421 if ( buildOptions . customCmakeOptions . size === 0 ) {
1522 const name = nameParts . join ( "-" ) ;
1623 return {
1724 withoutCustomCmakeOptions : name ,
18- withCustomCmakeOptions : name
25+ withCustomCmakeOptions : name ,
26+ binVariant : binParts . join ( "." )
1927 } ;
2028 }
2129
@@ -34,18 +42,21 @@ export async function getBuildFolderNameForBuildOptions(buildOptions: BuildOptio
3442 if ( cmakeOptionStringsArray . length === 0 ) {
3543 return {
3644 withoutCustomCmakeOptions : nameWithoutCustomCmakeOptions ,
37- withCustomCmakeOptions : nameWithoutCustomCmakeOptions
45+ withCustomCmakeOptions : nameWithoutCustomCmakeOptions ,
46+ binVariant : binParts . join ( "." )
3847 } ;
3948 }
4049
4150 const cmakeOptionsHash = await hashString ( cmakeOptionStringsArray . join ( ";" ) ) ;
4251
4352 nameParts . push ( cmakeOptionsHash ) ;
53+ binParts . push ( cmakeOptionsHash . slice ( 0 , 8 ) ) ;
4454 const nameWithCustomCmakeOptions = nameParts . join ( "-" ) ;
4555
4656 return {
4757 withoutCustomCmakeOptions : nameWithoutCustomCmakeOptions ,
48- withCustomCmakeOptions : nameWithCustomCmakeOptions
58+ withCustomCmakeOptions : nameWithCustomCmakeOptions ,
59+ binVariant : binParts . join ( "." )
4960 } ;
5061}
5162
@@ -60,7 +71,7 @@ async function getFolderNamePartForRelease(repo: string, release: string) {
6071 shouldHash = true ;
6172 resParts . push ( encodeURIComponent ( String ( owner ) ) + " " + encodeURIComponent ( String ( name ) ) ) ;
6273 } else
63- resParts . push ( owner + " " + name ) ;
74+ resParts . push ( String ( owner ) + " " + String ( name ) ) ;
6475 }
6576
6677 if ( containsUnsafeCharacters ( release ) ) {
0 commit comments