@@ -38,7 +38,6 @@ pub fn build(b: *std.Build) void {
3838 .use_png = true ,
3939 .use_glib = false ,
4040 .use_dwrite = false ,
41- .use_freetype = true ,
4241 .use_quartz = false ,
4342 .target = target ,
4443 .optimize = optimize ,
@@ -47,6 +46,7 @@ pub fn build(b: *std.Build) void {
4746 const libjpeg_turbo = b .dependency ("libjpeg_turbo" , .{
4847 .target = target ,
4948 .optimize = optimize ,
49+ .pie = true ,
5050 }).artifact ("libjpeg_turbo" );
5151
5252 const giflib = b .dependency ("giflib" , .{
@@ -86,19 +86,23 @@ pub fn build(b: *std.Build) void {
8686 .target = target ,
8787 .optimize = optimize ,
8888 .root_source_file = b .path ("src/unicode.zig" ),
89+ .link_libc = true ,
90+ .pic = true ,
8991 })
9092 });
9193
9294 unicode .root_module .addImport ("Scripts" , zg .module ("Scripts" ));
9395 unicode .root_module .addImport ("Graphemes" , zg .module ("Graphemes" ));
94- unicode .linkLibC ();
9596
9697 const canvas = b .addLibrary (.{
9798 .name = "canvas" ,
9899 .linkage = .dynamic ,
99100 .root_module = b .createModule (.{
100101 .target = target ,
101102 .optimize = optimize ,
103+ .pic = true ,
104+ .link_libc = true ,
105+ .link_libcpp = true ,
102106 })
103107 });
104108
@@ -107,7 +111,7 @@ pub fn build(b: *std.Build) void {
107111 .optimize = optimize ,
108112 }).artifact ("node_api" );
109113
110- canvas .addCSourceFiles (.{
114+ canvas .root_module . addCSourceFiles (.{
111115 .files = &.{
112116 "src/bmp/BMPParser.cc" ,
113117 "src/Canvas.cc" ,
@@ -149,24 +153,22 @@ pub fn build(b: *std.Build) void {
149153 canvas .root_module .strip = true ;
150154 }
151155
152- canvas .linkLibC ();
153- canvas .linkLibCpp ();
154- canvas .addObject (node_api );
155- canvas .linkLibrary (cairo );
156- canvas .linkLibrary (libjpeg_turbo );
157- canvas .linkLibrary (libpng );
158- canvas .linkLibrary (giflib );
159- canvas .linkLibrary (sheenbidi );
160- canvas .linkLibrary (unicode );
161- canvas .linkLibrary (harfbuzz );
162- canvas .linkLibrary (lunasvg );
156+ canvas .root_module .addObject (node_api );
157+ canvas .root_module .linkLibrary (cairo );
158+ canvas .root_module .linkLibrary (libjpeg_turbo );
159+ canvas .root_module .linkLibrary (libpng );
160+ canvas .root_module .linkLibrary (giflib );
161+ canvas .root_module .linkLibrary (sheenbidi );
162+ canvas .root_module .linkLibrary (unicode );
163+ canvas .root_module .linkLibrary (harfbuzz );
164+ canvas .root_module .linkLibrary (lunasvg );
163165
164166 // some deps, especially lunasvg, compile with -ffunction-sections and
165167 // -fdata-sections so we don't have to distribute unused parts of libraries
166168 canvas .link_gc_sections = true ;
167169
168170 if (target .result .os .tag == .windows ) {
169- canvas .linkSystemLibrary ("dwrite" );
171+ canvas .root_module . linkSystemLibrary ("dwrite" , .{} );
170172 }
171173
172174 if (target .result .os .tag == .macos ) {
@@ -184,19 +186,19 @@ pub fn build(b: *std.Build) void {
184186 " \r \n " ,
185187 );
186188
187- canvas .addSystemFrameworkPath (.{
189+ canvas .root_module . addSystemFrameworkPath (.{
188190 .cwd_relative = b .pathJoin (&.{
189191 path ,
190192 "Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/System/Library/Frameworks" ,
191193 }),
192194 });
193- canvas .addSystemIncludePath (.{
195+ canvas .root_module . addSystemIncludePath (.{
194196 .cwd_relative = b .pathJoin (&.{
195197 path ,
196198 "Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/include" ,
197199 }),
198200 });
199- canvas .addLibraryPath (.{
201+ canvas .root_module . addLibraryPath (.{
200202 .cwd_relative = b .pathJoin (&.{
201203 path ,
202204 "Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/lib" ,
0 commit comments