@@ -2761,33 +2761,23 @@ fn doTarget(
27612761 &.{if (target .os .tag != .windows ) "clap-validator" else "clap-validator.exe" },
27622762 &[0 ][]const u8 {},
27632763 ) catch null ) | program | {
2764- run .addArg (program );
2764+ run .addArg (program ); // Use system-installed clap-validator.
27652765 } else if (target .os .tag == .windows ) {
2766- run .addFileArg (std_extras .fetch (b , .{
2767- .url = "https://github.com/free-audio/clap-validator/releases/download/0.3.2/clap-validator-0.3.2-windows.zip" ,
2768- .file_name = "clap-validator.exe" ,
2769- .hash = "N-V-__8AAACYMwAKpkDTKEWrhJhUyBs1LxycLWN8iFpe5p6r" ,
2770- }));
2766+ if (b .lazyDependency ("clap_validator_windows" , .{})) | dep | {
2767+ run .addFileArg (dep .path ("clap-validator.exe" ));
2768+ }
27712769 } else if (target .os .tag == .macos ) {
2772- // Use downloaded binary for macOS
2773- const clap_validator_fetch = std_extras .fetch (b , .{
2774- .url = "https://github.com/free-audio/clap-validator/releases/download/0.3.2/clap-validator-0.3.2-macos-universal.tar.gz" ,
2775- .file_name = "clap-validator" ,
2776- .hash = "N-V-__8AALwZfgBlaKnVwge3d221LJA9s_vQixy9c6OBvGhQ" ,
2777- .executable = true ,
2778- });
2779- run .addFileArg (clap_validator_fetch );
2770+ if (b .lazyDependency ("clap_validator_macos" , .{})) | dep | {
2771+ const bin_path = dep .path ("clap-validator" );
2772+ run .addFileArg (bin_path );
2773+ run .step .dependOn (& chmodExeStep (b , bin_path ).step );
2774+ }
27802775 } else if (target .os .tag == .linux ) {
2781- // Linux - use downloaded binary.
2782- // NOTE: we're using floe-audio repo with a re-uploaded ZIP because we needed to workaround a
2783- // zig fetch bug with tar.gz files.
2784- const clap_validator_fetch = std_extras .fetch (b , .{
2785- .url = "https://github.com/floe-audio/clap-validator/releases/download/v0.3.2/clap-validator-0.3.2-ubuntu-18.04.zip" ,
2786- .file_name = "clap-validator" ,
2787- .hash = "N-V-__8AAFDvhAD7wsMQHzT9s_hiRLUTXJp4mBwyx_O7gZxZ" ,
2788- .executable = true ,
2789- });
2790- run .addFileArg (clap_validator_fetch );
2776+ if (b .lazyDependency ("clap_validator_linux" , .{})) | dep | {
2777+ const bin_path = dep .path ("clap-validator" );
2778+ run .addFileArg (bin_path );
2779+ run .step .dependOn (& chmodExeStep (b , bin_path ).step );
2780+ }
27912781 } else {
27922782 @panic ("Unsupported OS for clap-validator" );
27932783 }
@@ -2873,40 +2863,36 @@ fn addRunScript(
28732863 top_level_step .dependOn (& run_step .step );
28742864}
28752865
2866+ fn chmodExeStep (b : * std.Build , path : std.Build.LazyPath ) * std.Build.Step.Run {
2867+ const mod = b .addSystemCommand (&.{ "chmod" , "+x" });
2868+ mod .addFileArg (path );
2869+ return mod ;
2870+ }
2871+
28762872fn addPluginvalCommand (run : * std.Build.Step.Run , target : std.Target ) void {
28772873 const b = run .step .owner ;
28782874
28792875 if (b .findProgram (
28802876 &.{if (target .os .tag != .windows ) "pluginval" else "pluginval.exe" },
28812877 &[0 ][]const u8 {},
28822878 ) catch null ) | program | {
2883- // Use system-installed pluginval when explicitly requested
2884- run .addArg (program );
2879+ run .addArg (program ); // We found a system installation.
28852880 } else if (target .os .tag == .windows ) {
2886- // On Windows, we use a downloaded binary.
2887- run .addFileArg (std_extras .fetch (b , .{
2888- .url = "https://github.com/Tracktion/pluginval/releases/download/v1.0.3/pluginval_Windows.zip" ,
2889- .file_name = "pluginval.exe" ,
2890- .hash = "N-V-__8AAABcNACEKUY1SsEfHGFybDSKUo4JGhYN5bgZ146c" ,
2891- }));
2881+ if (b .lazyDependency ("pluginval_windows" , .{})) | dep | {
2882+ run .addFileArg (dep .path ("pluginval.exe" ));
2883+ }
28922884 } else if (target .os .tag == .macos ) {
2893- // Use downloaded binary for macOS
2894- const pluginval_fetch = std_extras .fetch (b , .{
2895- .url = "https://github.com/Tracktion/pluginval/releases/download/v1.0.3/pluginval_macOS.zip" ,
2896- .file_name = "Contents/MacOS/pluginval" ,
2897- .hash = "N-V-__8AAF8tGQHuEhO2q5y6oj6foKiCHCXCQWbfpY6ehS5e" ,
2898- .executable = true ,
2899- });
2900- run .addFileArg (pluginval_fetch );
2885+ if (b .lazyDependency ("pluginval_macos" , .{})) | dep | {
2886+ const bin_path = dep .path ("Contents/MacOS/pluginval" );
2887+ run .addFileArg (bin_path );
2888+ run .step .dependOn (& chmodExeStep (b , bin_path ).step );
2889+ }
29012890 } else if (target .os .tag == .linux ) {
2902- // Linux - use downloaded binary
2903- const pluginval_fetch = std_extras .fetch (b , .{
2904- .url = "https://github.com/Tracktion/pluginval/releases/download/v1.0.3/pluginval_Linux.zip" ,
2905- .file_name = "pluginval" ,
2906- .hash = "N-V-__8AAHiZqACvZuwhiWbvPBeJQd-K_5xpafp_Pi_6228J" ,
2907- .executable = true ,
2908- });
2909- run .addFileArg (pluginval_fetch );
2891+ if (b .lazyDependency ("pluginval_linux" , .{})) | dep | {
2892+ const bin_path = dep .path ("pluginval" );
2893+ run .addFileArg (bin_path );
2894+ run .step .dependOn (& chmodExeStep (b , bin_path ).step );
2895+ }
29102896 } else {
29112897 @panic ("Unsupported OS for pluginval" );
29122898 }
0 commit comments