@@ -32,6 +32,10 @@ def preprocess(i):
3232 package_name = f"Geekbench-{ need_version } -WindowsSetup.exe"
3333 env ['MLC_GEEKBENCH_NEED_EXTRACT' ] = 'no'
3434 elif os_info ['platform' ] == 'linux' :
35+ if env .get ('MLC_GEEKBENCH_INSTALLED_PATH' , '' ) != '' :
36+ build_path = os .path .join (env ['MLC_GEEKBENCH_INSTALLED_PATH' ], f"build.{ host_os_machine } " )
37+ if os .path .exists (build_path ):
38+ env ['MLC_GEEKBENCH_INSTALLED_PATH' ] = build_path
3539 if host_os_machine in ('aarch64' , 'arm64' ):
3640 arch_suffix = 'LinuxARMPreview'
3741 else :
@@ -84,13 +88,13 @@ def postprocess(i):
8488 # Windows: run.bat ran the installer and exported paths via tmp-run-env.out
8589 # MLC_GEEKBENCH_BIN_WITH_PATH is set from tmp-run-env.out
8690 geekbench_bin = env .get ('MLC_GEEKBENCH_BIN_WITH_PATH' , '' )
87- install_dir = env .get ('MLC_GEEKBENCH_WINDOWS_INSTALL_DIR ' , '' )
91+ install_dir = env .get ('MLC_GEEKBENCH_INSTALLED_PATH ' , '' )
8892
8993 if geekbench_bin == '' or not os .path .isfile (geekbench_bin ):
9094 # Fallback: try to find in the install dir
9195 if install_dir and os .path .isdir (install_dir ):
9296 for f in os .listdir (install_dir ):
93- if f .lower ().startswith ('geekbench6 ' ) and f .lower ().endswith ('.exe' ):
97+ if f .lower ().startswith (f'geekbench { env [ "MLC_GEEKBENCH_VERSION_MAJOR" ] } ' ) and f .lower ().endswith ('.exe' ):
9498 geekbench_bin = os .path .join (install_dir , f )
9599 break
96100
@@ -103,24 +107,23 @@ def postprocess(i):
103107
104108 else :
105109 # Linux / macOS: extracted archive
106- extracted_path = env .get ('MLC_GEEKBENCH_EXTRACTED_PATH' , '' )
107- if extracted_path == '' :
110+ geekbench_dir = env .get ('MLC_GEEKBENCH_INSTALLED_PATH' , env . get ( ' MLC_GEEKBENCH_EXTRACTED_PATH' , '' ) )
111+ if geekbench_dir == '' and env . get ( 'MLC_GEEKBENCH_INSTALLED_PATH' , '' ) == '' :
108112 return {'return' : 1 ,
109113 'error' : 'MLC_GEEKBENCH_EXTRACTED_PATH not set - download-and-extract may have failed' }
110114
111115 # Find the Geekbench directory inside the extracted path
112- geekbench_dir = extracted_path
113- if os .path .isdir (extracted_path ):
114- for d in sorted (os .listdir (extracted_path )):
115- full = os .path .join (extracted_path , d )
116+ if os .path .isdir (geekbench_dir ):
117+ for d in sorted (os .listdir (geekbench_dir )):
118+ full = os .path .join (geekbench_dir , d )
116119 if os .path .isdir (full ) and d .lower ().startswith ('geekbench' ):
117120 geekbench_dir = full
118121 break
119122
120123 if os_info ['platform' ] == 'darwin' :
121124 # macOS: binary is inside the .app bundle
122125 # e.g. Geekbench 6.app/Contents/MacOS/Geekbench 6
123- app_pattern = os .path .join (extracted_path , 'Geekbench*.app' )
126+ app_pattern = os .path .join (geekbench_dir , 'Geekbench*.app' )
124127 app_matches = glob .glob (app_pattern )
125128 if app_matches :
126129 app_dir = app_matches [0 ]
@@ -147,6 +150,9 @@ def postprocess(i):
147150 if os .path .isfile (geekbench_bin ):
148151 os .chmod (geekbench_bin , 0o755 )
149152
153+ if not os .path .exists (geekbench_dir ):
154+ return {'return' : 1 , 'error' : f'{ geekbench_dir } is not existing' }
155+
150156 env ['MLC_GEEKBENCH_BIN_WITH_PATH' ] = geekbench_bin
151157 env ['MLC_GEEKBENCH_INSTALLED_PATH' ] = geekbench_dir
152158 env ['MLC_GEEKBENCH_VERSION' ] = need_version
0 commit comments