@@ -60,7 +60,12 @@ void main(List<String> args) async {
6060 );
6161
6262 // run jom to build the library
63- await runProcess (jomProgram, ['-j' , '${Platform .numberOfProcessors }' ], workingDirectory: openSslDir, extraEnvironment: msvcEnv);
63+ await runProcess (
64+ jomProgram,
65+ ['-j' , '${Platform .numberOfProcessors }' ],
66+ workingDirectory: openSslDir,
67+ extraEnvironment: msvcEnv,
68+ );
6469
6570 // delete perl and jom if downloaded
6671 if (needDownloadPerl) {
@@ -72,6 +77,11 @@ void main(List<String> args) async {
7277 break ;
7378 case OS .macOS:
7479 case OS .linux:
80+ final hasPerl = await isProgramInstalled ('perl' );
81+ if (! hasPerl) {
82+ throw Exception ('perl is not installed, please install it to be able to build openssl.' );
83+ }
84+
7585 // run ./Configure with the target OS and architecture
7686 await runProcess ('./Configure' , [configName, ...configArgs], workingDirectory: openSslDir);
7787
@@ -80,19 +90,21 @@ void main(List<String> args) async {
8090 break ;
8191 }
8292
83- // copy the library to the output directory
93+ // determine the libName from OS and Link mode
8494 final libName = switch ((input.config.code.targetOS, input.config.code.linkModePreference)) {
8595 (OS .windows, LinkModePreference .static || LinkModePreference .preferStatic) => 'libcrypto_static.lib' ,
8696 (OS .macOS, LinkModePreference .static || LinkModePreference .preferStatic) => 'libcrypto.a' ,
8797 (OS .linux, LinkModePreference .static || LinkModePreference .preferStatic) => 'libcrypto.a' ,
88- (OS .windows, LinkModePreference .dynamic || LinkModePreference .preferDynamic) => 'libcrypto-3-${input .config .code .targetArchitecture .name }.dll' ,
98+ (OS .windows, LinkModePreference .dynamic || LinkModePreference .preferDynamic) =>
99+ 'libcrypto-3-${input .config .code .targetArchitecture .name }.dll' ,
89100 (OS .macOS, LinkModePreference .dynamic || LinkModePreference .preferDynamic) => 'libcrypto.dylib' ,
90101 (OS .linux, LinkModePreference .dynamic || LinkModePreference .preferDynamic) => 'libcrypto.so' ,
91102 _ => throw UnsupportedError (
92103 'Unsupported target OS: ${input .config .code .targetOS .name } or link mode preference: ${input .config .code .linkModePreference .name }' ,
93104 ),
94105 };
95106
107+ // copy the library to the output directory
96108 final libPath = outputDir.resolve (libName).toFilePath (windows: Platform .isWindows);
97109 await File (openSslDir.resolve (libName).toFilePath (windows: Platform .isWindows)).copy (libPath);
98110
0 commit comments