@@ -146,48 +146,25 @@ function isCI() {
146146function checkBuildTools ( platform ) {
147147 logStep ( '1/6' , '检查构建工具' ) ;
148148
149- const requiredTools = [ 'git' , 'autoconf' , 'automake' , 'libtool ' , 'make' ] ;
149+ const requiredTools = [ 'git' , 'autoconf' , 'automake' , 'libtoolize ' , 'make' ] ;
150150 const missingTools = [ ] ;
151151
152152 for ( const tool of requiredTools ) {
153- let found = false ;
154- let toolPath = '' ;
155-
156153 try {
157- // 尝试直接运行工具的 --version 来验证(最可靠的方法)
158- const versionCheck = exec ( `${ tool } --version 2>&1` , { silent : true , ignoreError : false } ) ;
159- if ( versionCheck ) {
160- found = true ;
161- // 尝试获取工具路径
162- const pathCheck = exec ( `command -v ${ tool } 2>/dev/null || which ${ tool } 2>/dev/null || echo "(installed)"` , { silent : true , ignoreError : true } ) ;
163- toolPath = pathCheck ? pathCheck . trim ( ) : '(installed)' ;
164- }
154+ // 简化:只检测工具是否可执行,不获取详细路径
155+ exec ( `${ tool } --version 2>&1` , { silent : true , ignoreError : false } ) ;
156+ logSuccess ( `找到 ${ tool } ` ) ;
165157 } catch ( error ) {
166- // 工具不存在或执行失败
167- found = false ;
168- }
169-
170- if ( found ) {
171- logSuccess ( `找到 ${ tool } ${ toolPath !== '(installed)' ? ': ' + toolPath : '' } ` ) ;
172- } else {
173158 missingTools . push ( tool ) ;
174159 }
175160 }
176161
177162 if ( missingTools . length > 0 ) {
178- logError ( '缺少必需的构建工具:' ) ;
179- console . log ( ' ' + missingTools . join ( ', ' ) ) ;
180- console . log ( ) ;
181-
182- if ( platform === 'macos' ) {
183- log ( '在 macOS 上安装构建工具:' , 'yellow' ) ;
184- log ( ' brew install autoconf automake libtool' , 'bright' ) ;
185- } else if ( platform === 'linux' ) {
186- log ( '在 Linux 上安装构建工具:' , 'yellow' ) ;
187- log ( ' sudo apt-get install autoconf automake libtool pkg-config # Debian/Ubuntu' , 'bright' ) ;
188- log ( ' sudo yum install autoconf automake libtool # CentOS/RHEL' , 'bright' ) ;
189- }
190-
163+ logError ( `缺少必需的构建工具: ${ missingTools . join ( ', ' ) } ` ) ;
164+ const installCmd = platform === 'macos'
165+ ? 'brew install autoconf automake libtool'
166+ : 'sudo apt-get install autoconf automake libtool pkg-config' ;
167+ log ( `安装命令: ${ installCmd } ` , 'bright' ) ;
191168 process . exit ( 1 ) ;
192169 }
193170
0 commit comments