@depup/sharp 0.34.5-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,298 @@
1
+ # Copyright 2013 Lovell Fuller and others.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ {
5
+ 'variables': {
6
+ 'vips_version': '<!(node -p "require(\'../lib/libvips\').minimumLibvipsVersion")',
7
+ 'platform_and_arch': '<!(node -p "require(\'../lib/libvips\').buildPlatformArch()")',
8
+ 'sharp_libvips_version': '<!(node -p "require(\'../package.json\').optionalDependencies[\'@img/sharp-libvips-<(platform_and_arch)\']")',
9
+ 'sharp_libvips_yarn_locator': '<!(node -p "require(\'../lib/libvips\').yarnLocator()")',
10
+ 'sharp_libvips_include_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsIncludeDir()")',
11
+ 'sharp_libvips_cplusplus_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsCPlusPlusDir()")',
12
+ 'sharp_libvips_lib_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsLibDir()")'
13
+ },
14
+ 'targets': [{
15
+ 'target_name': 'libvips-cpp-<(vips_version)',
16
+ 'conditions': [
17
+ ['OS == "win"', {
18
+ # Build libvips C++ binding for Windows due to MSVC std library ABI changes
19
+ 'type': 'shared_library',
20
+ 'defines': [
21
+ '_VIPS_PUBLIC=__declspec(dllexport)',
22
+ '_ALLOW_KEYWORD_MACROS',
23
+ 'G_DISABLE_ASSERT',
24
+ 'G_DISABLE_CAST_CHECKS',
25
+ 'G_DISABLE_CHECKS'
26
+ ],
27
+ 'sources': [
28
+ '<(sharp_libvips_cplusplus_dir)/VConnection.cpp',
29
+ '<(sharp_libvips_cplusplus_dir)/VError.cpp',
30
+ '<(sharp_libvips_cplusplus_dir)/VImage.cpp',
31
+ '<(sharp_libvips_cplusplus_dir)/VInterpolate.cpp',
32
+ '<(sharp_libvips_cplusplus_dir)/VRegion.cpp'
33
+ ],
34
+ 'include_dirs': [
35
+ '<(sharp_libvips_include_dir)',
36
+ '<(sharp_libvips_include_dir)/glib-2.0',
37
+ '<(sharp_libvips_lib_dir)/glib-2.0/include'
38
+ ],
39
+ 'link_settings': {
40
+ 'library_dirs': [
41
+ '<(sharp_libvips_lib_dir)'
42
+ ],
43
+ 'libraries': [
44
+ 'libvips.lib'
45
+ ],
46
+ },
47
+ 'configurations': {
48
+ 'Release': {
49
+ 'msvs_settings': {
50
+ 'VCCLCompilerTool': {
51
+ "AdditionalOptions": [
52
+ "/std:c++17"
53
+ ],
54
+ 'ExceptionHandling': 1,
55
+ 'Optimization': 1,
56
+ 'WholeProgramOptimization': 'true'
57
+ },
58
+ 'VCLibrarianTool': {
59
+ 'AdditionalOptions': [
60
+ '/LTCG:INCREMENTAL'
61
+ ]
62
+ },
63
+ 'VCLinkerTool': {
64
+ 'ImageHasSafeExceptionHandlers': 'false',
65
+ 'OptimizeReferences': 2,
66
+ 'EnableCOMDATFolding': 2,
67
+ 'LinkIncremental': 1,
68
+ 'AdditionalOptions': [
69
+ '/LTCG:INCREMENTAL'
70
+ ]
71
+ }
72
+ },
73
+ 'msvs_disabled_warnings': [
74
+ 4275
75
+ ]
76
+ }
77
+ }
78
+ }, {
79
+ # Ignore this target for non-Windows
80
+ 'type': 'none'
81
+ }]
82
+ ]
83
+ }, {
84
+ 'target_name': 'sharp-<(platform_and_arch)',
85
+ 'defines': [
86
+ 'G_DISABLE_ASSERT',
87
+ 'G_DISABLE_CAST_CHECKS',
88
+ 'G_DISABLE_CHECKS',
89
+ 'NAPI_VERSION=9',
90
+ 'NODE_ADDON_API_DISABLE_DEPRECATED',
91
+ 'NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS'
92
+ ],
93
+ 'dependencies': [
94
+ '<!(node -p "require(\'node-addon-api\').gyp")',
95
+ 'libvips-cpp-<(vips_version)'
96
+ ],
97
+ 'variables': {
98
+ 'conditions': [
99
+ ['OS != "win"', {
100
+ 'pkg_config_path': '<!(node -p "require(\'../lib/libvips\').pkgConfigPath()")',
101
+ 'use_global_libvips': '<!(node -p "Boolean(require(\'../lib/libvips\').useGlobalLibvips()).toString()")'
102
+ }, {
103
+ 'pkg_config_path': '',
104
+ 'use_global_libvips': ''
105
+ }]
106
+ ]
107
+ },
108
+ 'sources': [
109
+ 'common.cc',
110
+ 'metadata.cc',
111
+ 'stats.cc',
112
+ 'operations.cc',
113
+ 'pipeline.cc',
114
+ 'utilities.cc',
115
+ 'sharp.cc'
116
+ ],
117
+ 'include_dirs': [
118
+ '<!(node -p "require(\'node-addon-api\').include_dir")',
119
+ ],
120
+ 'conditions': [
121
+ ['use_global_libvips == "true"', {
122
+ # Use pkg-config for include and lib
123
+ 'include_dirs': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g)'],
124
+ 'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)'],
125
+ 'defines': [
126
+ 'SHARP_USE_GLOBAL_LIBVIPS'
127
+ ],
128
+ 'conditions': [
129
+ ['OS == "linux"', {
130
+ 'defines': [
131
+ # Inspect libvips-cpp.so to determine which C++11 ABI version was used and set _GLIBCXX_USE_CXX11_ABI accordingly. This is quite horrible.
132
+ '_GLIBCXX_USE_CXX11_ABI=<!(if readelf -Ws "$(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --variable libdir vips-cpp)/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi)'
133
+ ]
134
+ }]
135
+ ]
136
+ }, {
137
+ # Use pre-built libvips stored locally within node_modules
138
+ 'include_dirs': [
139
+ '<(sharp_libvips_include_dir)',
140
+ '<(sharp_libvips_include_dir)/glib-2.0',
141
+ '<(sharp_libvips_lib_dir)/glib-2.0/include'
142
+ ],
143
+ 'library_dirs': [
144
+ '<(sharp_libvips_lib_dir)'
145
+ ],
146
+ 'conditions': [
147
+ ['OS == "win"', {
148
+ 'defines': [
149
+ '_ALLOW_KEYWORD_MACROS',
150
+ '_FILE_OFFSET_BITS=64'
151
+ ],
152
+ 'link_settings': {
153
+ 'libraries': [
154
+ 'libvips.lib'
155
+ ]
156
+ }
157
+ }],
158
+ ['OS == "mac"', {
159
+ 'link_settings': {
160
+ 'libraries': [
161
+ 'libvips-cpp.<(vips_version).dylib'
162
+ ]
163
+ },
164
+ 'xcode_settings': {
165
+ 'OTHER_LDFLAGS': [
166
+ '-Wl,-s',
167
+ '-Wl,-dead_strip',
168
+ # Ensure runtime linking is relative to sharp.node
169
+ '-Wl,-rpath,\'@loader_path/../../sharp-libvips-<(platform_and_arch)/lib\'',
170
+ '-Wl,-rpath,\'@loader_path/../../../sharp-libvips-<(platform_and_arch)/<(sharp_libvips_version)/lib\'',
171
+ '-Wl,-rpath,\'@loader_path/../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
172
+ '-Wl,-rpath,\'@loader_path/../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
173
+ '-Wl,-rpath,\'@loader_path/../../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
174
+ '-Wl,-rpath,\'@loader_path/../../../../../@img-sharp-libvips-<(platform_and_arch)-npm-<(sharp_libvips_version)-<(sharp_libvips_yarn_locator)/node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\''
175
+ ]
176
+ }
177
+ }],
178
+ ['OS == "linux"', {
179
+ 'defines': [
180
+ '_GLIBCXX_USE_CXX11_ABI=1'
181
+ ],
182
+ 'cflags_cc': [
183
+ '<!(node -p "require(\'detect-libc\').isNonGlibcLinuxSync() ? \'\' : \'-flto=auto\'")'
184
+ ],
185
+ 'link_settings': {
186
+ 'libraries': [
187
+ '-l:libvips-cpp.so.<(vips_version)'
188
+ ],
189
+ 'ldflags': [
190
+ '-lstdc++fs',
191
+ '-Wl,-s',
192
+ '-Wl,--disable-new-dtags',
193
+ '-Wl,-z,nodelete',
194
+ '-Wl,-Bsymbolic-functions',
195
+ '-Wl,-rpath=\'$$ORIGIN/../../sharp-libvips-<(platform_and_arch)/lib\'',
196
+ '-Wl,-rpath=\'$$ORIGIN/../../../sharp-libvips-<(platform_and_arch)/<(sharp_libvips_version)/lib\'',
197
+ '-Wl,-rpath=\'$$ORIGIN/../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
198
+ '-Wl,-rpath=\'$$ORIGIN/../../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'',
199
+ '-Wl,-rpath,\'$$ORIGIN/../../../../../@img-sharp-libvips-<(platform_and_arch)-npm-<(sharp_libvips_version)-<(sharp_libvips_yarn_locator)/node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\''
200
+ ]
201
+ }
202
+ }],
203
+ ['OS == "emscripten"', {
204
+ 'product_extension': 'node.js',
205
+ 'link_settings': {
206
+ 'ldflags': [
207
+ '-fexceptions',
208
+ '--pre-js=<!(node -p "require.resolve(\'./emscripten/pre.js\')")',
209
+ '-Oz',
210
+ '-sALLOW_MEMORY_GROWTH',
211
+ '-sENVIRONMENT=node',
212
+ '-sEXPORTED_FUNCTIONS=emnapiInit,_vips_shutdown,_uv_library_shutdown',
213
+ '-sNODERAWFS',
214
+ '-sWASM_ASYNC_COMPILATION=0'
215
+ ],
216
+ 'libraries': [
217
+ '<!@(PKG_CONFIG_PATH="<!(node -p "require(\'@img/sharp-libvips-dev-wasm32/lib\')")/pkgconfig" pkg-config --static --libs vips-cpp)'
218
+ ],
219
+ }
220
+ }]
221
+ ]
222
+ }]
223
+ ],
224
+ 'cflags_cc': [
225
+ '-std=c++17',
226
+ '-fexceptions',
227
+ '-Wall',
228
+ '-Os'
229
+ ],
230
+ 'xcode_settings': {
231
+ 'CLANG_CXX_LANGUAGE_STANDARD': 'c++17',
232
+ 'MACOSX_DEPLOYMENT_TARGET': '10.15',
233
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
234
+ 'GCC_ENABLE_CPP_RTTI': 'YES',
235
+ 'OTHER_CPLUSPLUSFLAGS': [
236
+ '-fexceptions',
237
+ '-Wall',
238
+ '-Oz'
239
+ ]
240
+ },
241
+ 'configurations': {
242
+ 'Release': {
243
+ 'conditions': [
244
+ ['target_arch == "arm"', {
245
+ 'cflags_cc': [
246
+ '-Wno-psabi'
247
+ ]
248
+ }],
249
+ ['OS == "win"', {
250
+ 'msvs_settings': {
251
+ 'VCCLCompilerTool': {
252
+ "AdditionalOptions": [
253
+ "/std:c++17"
254
+ ],
255
+ 'ExceptionHandling': 1,
256
+ 'Optimization': 1,
257
+ 'WholeProgramOptimization': 'true'
258
+ },
259
+ 'VCLibrarianTool': {
260
+ 'AdditionalOptions': [
261
+ '/LTCG:INCREMENTAL'
262
+ ]
263
+ },
264
+ 'VCLinkerTool': {
265
+ 'ImageHasSafeExceptionHandlers': 'false',
266
+ 'OptimizeReferences': 2,
267
+ 'EnableCOMDATFolding': 2,
268
+ 'LinkIncremental': 1,
269
+ 'AdditionalOptions': [
270
+ '/LTCG:INCREMENTAL'
271
+ ]
272
+ }
273
+ },
274
+ 'msvs_disabled_warnings': [
275
+ 4275
276
+ ]
277
+ }]
278
+ ]
279
+ }
280
+ },
281
+ }, {
282
+ 'target_name': 'copy-dll',
283
+ 'type': 'none',
284
+ 'dependencies': [
285
+ 'sharp-<(platform_and_arch)'
286
+ ],
287
+ 'conditions': [
288
+ ['OS == "win"', {
289
+ 'copies': [{
290
+ 'destination': 'build/Release',
291
+ 'files': [
292
+ '<(sharp_libvips_lib_dir)/libvips-42.dll'
293
+ ]
294
+ }]
295
+ }]
296
+ ]
297
+ }]
298
+ }