Skip to content

Commit 4ccab4f

Browse files
Fix detect-libc
1 parent 3642575 commit 4ccab4f

File tree

2 files changed

+38
-211
lines changed

2 files changed

+38
-211
lines changed

binding.gyp

Lines changed: 28 additions & 205 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,7 @@
11
{
2-
'conditions': [
3-
['OS=="win"', {
4-
'variables': {
5-
'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle
6-
'with_jpeg%': 'false',
7-
'with_gif%': 'false',
8-
'with_rsvg%': 'false',
9-
'variables': { # Nest jpeg_root to evaluate it before with_jpeg
10-
'jpeg_root%': '<!(node ./util/win_jpeg_lookup)'
11-
},
12-
'jpeg_root%': '<(jpeg_root)', # Take value of nested variable
13-
'conditions': [
14-
['jpeg_root==""', {
15-
'with_jpeg%': 'false'
16-
}, {
17-
'with_jpeg%': 'true'
18-
}]
19-
]
20-
}
21-
}, { # 'OS!="win"'
22-
'variables': {
23-
'with_jpeg%': '<!(node ./util/has_lib.js jpeg)',
24-
'with_gif%': '<!(node ./util/has_lib.js gif)',
25-
'with_rsvg%': '<!(node ./util/has_lib.js rsvg)'
26-
}
27-
}]
28-
],
292
'targets': [
30-
{
31-
'target_name': 'canvas-postbuild',
32-
'dependencies': ['canvas'],
33-
'conditions': [
34-
['OS=="win"', {
35-
'copies': [{
36-
'destination': '<(PRODUCT_DIR)',
37-
'files': [
38-
'<(GTK_Root)/bin/zlib1.dll',
39-
'<(GTK_Root)/bin/libintl-8.dll',
40-
'<(GTK_Root)/bin/libpng14-14.dll',
41-
'<(GTK_Root)/bin/libpangocairo-1.0-0.dll',
42-
'<(GTK_Root)/bin/libpango-1.0-0.dll',
43-
'<(GTK_Root)/bin/libpangoft2-1.0-0.dll',
44-
'<(GTK_Root)/bin/libpangowin32-1.0-0.dll',
45-
'<(GTK_Root)/bin/libcairo-2.dll',
46-
'<(GTK_Root)/bin/libfontconfig-1.dll',
47-
'<(GTK_Root)/bin/libfreetype-6.dll',
48-
'<(GTK_Root)/bin/libglib-2.0-0.dll',
49-
'<(GTK_Root)/bin/libgobject-2.0-0.dll',
50-
'<(GTK_Root)/bin/libgmodule-2.0-0.dll',
51-
'<(GTK_Root)/bin/libgthread-2.0-0.dll',
52-
'<(GTK_Root)/bin/libexpat-1.dll'
53-
]
54-
}]
55-
}]
56-
]
57-
},
583
{
594
'target_name': 'canvas',
60-
'include_dirs': ["<!(node -e \"require('nan')\")"],
615
'sources': [
626
'src/backend/Backend.cc',
637
'src/backend/ImageBackend.cc',
@@ -76,155 +20,34 @@
7620
'src/init.cc',
7721
'src/register_font.cc'
7822
],
79-
'conditions': [
80-
['OS=="win"', {
81-
'libraries': [
82-
'-l<(GTK_Root)/lib/cairo.lib',
83-
'-l<(GTK_Root)/lib/libpng.lib',
84-
'-l<(GTK_Root)/lib/pangocairo-1.0.lib',
85-
'-l<(GTK_Root)/lib/pango-1.0.lib',
86-
'-l<(GTK_Root)/lib/freetype.lib',
87-
'-l<(GTK_Root)/lib/glib-2.0.lib',
88-
'-l<(GTK_Root)/lib/gobject-2.0.lib'
89-
],
90-
'include_dirs': [
91-
'<(GTK_Root)/include',
92-
'<(GTK_Root)/include/cairo',
93-
'<(GTK_Root)/include/pango-1.0',
94-
'<(GTK_Root)/include/glib-2.0',
95-
'<(GTK_Root)/include/freetype2',
96-
'<(GTK_Root)/lib/glib-2.0/include'
97-
],
98-
'defines': [
99-
'_USE_MATH_DEFINES', # for M_PI
100-
'NOMINMAX' # allow std::min/max to work
101-
],
102-
'configurations': {
103-
'Debug': {
104-
'msvs_settings': {
105-
'VCCLCompilerTool': {
106-
'WarningLevel': 4,
107-
'ExceptionHandling': 1,
108-
'DisableSpecificWarnings': [
109-
4100, 4611
110-
]
111-
}
112-
}
113-
},
114-
'Release': {
115-
'msvs_settings': {
116-
'VCCLCompilerTool': {
117-
'WarningLevel': 4,
118-
'ExceptionHandling': 1,
119-
'DisableSpecificWarnings': [
120-
4100, 4611
121-
]
122-
}
123-
}
124-
}
125-
}
126-
}, { # 'OS!="win"'
127-
'libraries': [
128-
'<!@(pkg-config pixman-1 --libs)',
129-
'<!@(pkg-config cairo --libs)',
130-
'<!@(pkg-config libpng --libs)',
131-
'<!@(pkg-config pangocairo --libs)',
132-
'<!@(pkg-config freetype2 --libs)'
133-
],
134-
'include_dirs': [
135-
'<!@(pkg-config cairo --cflags-only-I | sed s/-I//g)',
136-
'<!@(pkg-config libpng --cflags-only-I | sed s/-I//g)',
137-
'<!@(pkg-config pangocairo --cflags-only-I | sed s/-I//g)',
138-
'<!@(pkg-config freetype2 --cflags-only-I | sed s/-I//g)'
139-
],
140-
'cflags': ['-Wno-cast-function-type'],
141-
'cflags!': ['-fno-exceptions'],
142-
'cflags_cc!': ['-fno-exceptions']
143-
}],
144-
['OS=="mac"', {
145-
'xcode_settings': {
146-
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
147-
}
148-
}],
149-
['with_jpeg=="true"', {
150-
'defines': [
151-
'HAVE_JPEG'
152-
],
153-
'conditions': [
154-
['OS=="win"', {
155-
'copies': [{
156-
'destination': '<(PRODUCT_DIR)',
157-
'files': [
158-
'<(jpeg_root)/bin/jpeg62.dll',
159-
]
160-
}],
161-
'include_dirs': [
162-
'<(jpeg_root)/include'
163-
],
164-
'libraries': [
165-
'-l<(jpeg_root)/lib/jpeg.lib',
166-
]
167-
}, {
168-
'include_dirs': [
169-
'<!@(pkg-config libjpeg --cflags-only-I | sed s/-I//g)'
170-
],
171-
'libraries': [
172-
'<!@(pkg-config libjpeg --libs)'
173-
]
174-
}]
175-
]
176-
}],
177-
['with_gif=="true"', {
178-
'defines': [
179-
'HAVE_GIF'
180-
],
181-
'conditions': [
182-
['OS=="win"', {
183-
'libraries': [
184-
'-l<(GTK_Root)/lib/gif.lib'
185-
]
186-
}, {
187-
'include_dirs': [
188-
'/opt/homebrew/include'
189-
],
190-
'libraries': [
191-
'-L/opt/homebrew/lib',
192-
'-lgif'
193-
]
194-
}]
195-
]
196-
}],
197-
['with_rsvg=="true"', {
198-
'defines': [
199-
'HAVE_RSVG'
200-
],
201-
'conditions': [
202-
['OS=="win"', {
203-
'copies': [{
204-
'destination': '<(PRODUCT_DIR)',
205-
'files': [
206-
'<(GTK_Root)/bin/librsvg-2-2.dll',
207-
'<(GTK_Root)/bin/libgdk_pixbuf-2.0-0.dll',
208-
'<(GTK_Root)/bin/libgio-2.0-0.dll',
209-
'<(GTK_Root)/bin/libcroco-0.6-3.dll',
210-
'<(GTK_Root)/bin/libgsf-1-114.dll',
211-
'<(GTK_Root)/bin/libxml2-2.dll'
212-
]
213-
}],
214-
'libraries': [
215-
'-l<(GTK_Root)/lib/librsvg-2-2.lib'
216-
]
217-
}, {
218-
'include_dirs': [
219-
'<!@(pkg-config librsvg-2.0 --cflags-only-I | sed s/-I//g)'
220-
],
221-
'libraries': [
222-
'<!@(pkg-config librsvg-2.0 --libs)'
223-
]
224-
}]
225-
]
226-
}]
227-
]
23+
'defines': [
24+
'HAVE_GIF',
25+
'HAVE_JPEG',
26+
'HAVE_RSVG'
27+
],
28+
'libraries': [
29+
'<!@(pkg-config pixman-1 --libs)',
30+
'<!@(pkg-config cairo --libs)',
31+
'<!@(pkg-config libpng --libs)',
32+
'<!@(pkg-config pangocairo --libs)',
33+
'<!@(pkg-config freetype2 --libs)',
34+
'<!@(pkg-config librsvg-2.0 --libs)',
35+
'-ljpeg',
36+
'-lgif'
37+
],
38+
'include_dirs': [
39+
'<!(node -e "require(\'nan\')")',
40+
'<!@(pkg-config cairo --cflags-only-I | sed s/-I//g)',
41+
'<!@(pkg-config libpng --cflags-only-I | sed s/-I//g)',
42+
'<!@(pkg-config pangocairo --cflags-only-I | sed s/-I//g)',
43+
'<!@(pkg-config freetype2 --cflags-only-I | sed s/-I//g)',
44+
'<!@(pkg-config librsvg-2.0 --cflags-only-I | sed s/-I//g)'
45+
],
46+
'ldflags': [
47+
'-Wl,-rpath \'-Wl,$$ORIGIN\''
48+
],
49+
'cflags!': ['-fno-exceptions'],
50+
'cflags_cc!': ['-fno-exceptions']
22851
}
22952
]
23053
}

prebuild/tarball.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Generate the node-gyp formatted filename from the node environment
2-
FILENAME=$(node -e " \
3-
var p = process, v = p.versions, libc = require('detect-libc').family || 'unknown'; \
4-
const tagName = p.env.UPLOAD_TO || p.env.CANVAS_VERSION_TO_BUILD; \
5-
const arch = p.env.CANVAS_ARCH_TO_BUILD || p.arch; \
6-
console.log(['canvas', tagName, 'node-v' + v.modules, p.platform, libc, arch].join('-')); \
7-
").tar.gz;
2+
npm install --global detect-libc
3+
4+
FILENAME=$(
5+
node -e "
6+
var p = process, v = p.versions, libc = require('detect-libc').familySync() || 'unknown';
7+
const tagName = p.env.UPLOAD_TO || p.env.CANVAS_VERSION_TO_BUILD;
8+
const arch = p.env.CANVAS_ARCH_TO_BUILD || p.arch;
9+
console.log(['canvas', tagName, 'node-v' + v.modules, p.platform, libc, arch].join('-'));
10+
"
11+
).tar.gz;
812

913
# Zip up the release
1014
tar -C build -czvf $FILENAME Release

0 commit comments

Comments
 (0)