@@ -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" ,
@@ -150,24 +154,22 @@ pub fn build(b: *std.Build) void {
150154 canvas .root_module .strip = true ;
151155 }
152156
153- canvas .linkLibC ();
154- canvas .linkLibCpp ();
155- canvas .addObject (node_api );
156- canvas .linkLibrary (cairo );
157- canvas .linkLibrary (libjpeg_turbo );
158- canvas .linkLibrary (libpng );
159- canvas .linkLibrary (giflib );
160- canvas .linkLibrary (sheenbidi );
161- canvas .linkLibrary (unicode );
162- canvas .linkLibrary (harfbuzz );
163- canvas .linkLibrary (lunasvg );
157+ canvas .root_module .addObject (node_api );
158+ canvas .root_module .linkLibrary (cairo );
159+ canvas .root_module .linkLibrary (libjpeg_turbo );
160+ canvas .root_module .linkLibrary (libpng );
161+ canvas .root_module .linkLibrary (giflib );
162+ canvas .root_module .linkLibrary (sheenbidi );
163+ canvas .root_module .linkLibrary (unicode );
164+ canvas .root_module .linkLibrary (harfbuzz );
165+ canvas .root_module .linkLibrary (lunasvg );
164166
165167 // some deps, especially lunasvg, compile with -ffunction-sections and
166168 // -fdata-sections so we don't have to distribute unused parts of libraries
167169 canvas .link_gc_sections = true ;
168170
169171 if (target .result .os .tag == .windows ) {
170- canvas .linkSystemLibrary ("dwrite" );
172+ canvas .root_module . linkSystemLibrary ("dwrite" , .{} );
171173 }
172174
173175 if (target .result .os .tag == .macos ) {
@@ -185,19 +187,19 @@ pub fn build(b: *std.Build) void {
185187 " \r \n " ,
186188 );
187189
188- canvas .addSystemFrameworkPath (.{
190+ canvas .root_module . addSystemFrameworkPath (.{
189191 .cwd_relative = b .pathJoin (&.{
190192 path ,
191193 "Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/System/Library/Frameworks" ,
192194 }),
193195 });
194- canvas .addSystemIncludePath (.{
196+ canvas .root_module . addSystemIncludePath (.{
195197 .cwd_relative = b .pathJoin (&.{
196198 path ,
197199 "Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/include" ,
198200 }),
199201 });
200- canvas .addLibraryPath (.{
202+ canvas .root_module . addLibraryPath (.{
201203 .cwd_relative = b .pathJoin (&.{
202204 path ,
203205 "Platforms/MacOSX.platform/Developer/SDKs/" ++ sdk ++ "/usr/lib" ,
0 commit comments