ruby-exiv2 1.3 → 1.5
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.
- data/README +1 -0
- data/Rakefile +5 -29
- data/{ext → lib}/exiv2.hpp +4 -4
- data/lib/exiv2.rb +22 -28
- data/lib/exiv2/exif.rb +19 -0
- data/lib/exiv2/image.rb +205 -0
- data/lib/exiv2/iptc.rb +19 -0
- data/lib/exiv2/metadata/clear.cpp +14 -0
- data/lib/exiv2/metadata/count.cpp +10 -0
- data/lib/exiv2/metadata/delete.cpp +23 -0
- data/lib/exiv2/metadata/each.cpp +26 -0
- data/lib/exiv2/metadata/get.cpp +21 -0
- data/lib/exiv2/metadata/is_empty.cpp +10 -0
- data/lib/exiv2/metadata/marshall.cpp +85 -0
- data/lib/exiv2/metadata/set.cpp +16 -0
- data/{ext/marshall.cpp → lib/exiv2/metadata/unmarshall.cpp} +0 -1
- data/lib/exiv2/tag.rb +110 -0
- data/lib/exiv2/throw.cpp +12 -0
- data/test/{image.rb → test_image.rb} +14 -2
- metadata +58 -48
- data/ext/exif.cpp +0 -369
- data/ext/exiv2.cpp +0 -78
- data/ext/extconf.rb +0 -75
- data/ext/image.cpp +0 -230
- data/ext/iptc.cpp +0 -253
- data/setup.rb +0 -1585
data/ext/exif.cpp
DELETED
@@ -1,369 +0,0 @@
|
|
1
|
-
#include "exiv2.hpp"
|
2
|
-
|
3
|
-
/*
|
4
|
-
* First, I have to get out type by key. If such key is forbidden, I will refuse to marshall it.
|
5
|
-
* Then, I will cast ruby VALUE to C++ value, according to type_id
|
6
|
-
* then I will just set apropreciated hash entry to this casted value
|
7
|
-
*/
|
8
|
-
static bool marshall_value(Exiv2::ExifData &data, const char* key, VALUE value) {
|
9
|
-
Exiv2::TypeId type_id;
|
10
|
-
try {
|
11
|
-
Exiv2::ExifKey exif_key(key);
|
12
|
-
type_id = Exiv2::ExifTags::tagType(exif_key.tag(), exif_key.ifdId());
|
13
|
-
}
|
14
|
-
catch(Exiv2::Error& e) {
|
15
|
-
rb_raise(eError, "Cannot set tag %s because it doesn't exists. Look at http://www.exiv2.org/tags.html for list of supported tags", key);
|
16
|
-
}
|
17
|
-
switch(type_id) {
|
18
|
-
case Exiv2::invalidTypeId:
|
19
|
-
{
|
20
|
-
rb_warn("Trying to marshall invalid type id");
|
21
|
-
return Qnil;
|
22
|
-
}
|
23
|
-
|
24
|
-
case Exiv2::unsignedByte:
|
25
|
-
case Exiv2::unsignedShort:
|
26
|
-
case Exiv2::unsignedLong:
|
27
|
-
case Exiv2::signedShort:
|
28
|
-
case Exiv2::signedLong:
|
29
|
-
{
|
30
|
-
data[key] = NUM2INT(value);
|
31
|
-
return true;
|
32
|
-
}
|
33
|
-
|
34
|
-
case Exiv2::asciiString:
|
35
|
-
case Exiv2::string:
|
36
|
-
case Exiv2::undefined:
|
37
|
-
{
|
38
|
-
data[key] = std::string(STR(value));
|
39
|
-
return true;
|
40
|
-
}
|
41
|
-
|
42
|
-
case Exiv2::unsignedRational:
|
43
|
-
case Exiv2::signedRational:
|
44
|
-
{
|
45
|
-
if(rb_respond_to(value, rb_intern("numerator"))) {
|
46
|
-
int numerator = NUM2INT(rb_funcall(value, rb_intern("numerator"), 0));
|
47
|
-
int denominator = NUM2INT(rb_funcall(value, rb_intern("denominator"), 0));
|
48
|
-
data[key] = Exiv2::Rational(numerator, denominator);
|
49
|
-
return true;
|
50
|
-
}
|
51
|
-
data[key] = Exiv2::Rational(NUM2INT(value), 1);
|
52
|
-
return true;
|
53
|
-
}
|
54
|
-
case Exiv2::date: {
|
55
|
-
int year = NUM2INT(rb_funcall(value, rb_intern("year"), 0));
|
56
|
-
int month = NUM2INT(rb_funcall(value, rb_intern("month"), 0));
|
57
|
-
int day = NUM2INT(rb_funcall(value, rb_intern("day"), 0));
|
58
|
-
data[key] = Exiv2::DateValue(year, month, day);
|
59
|
-
return true;
|
60
|
-
}
|
61
|
-
case Exiv2::time: {
|
62
|
-
int hour = NUM2INT(rb_funcall(value, rb_intern("hour"), 0));
|
63
|
-
int minute = NUM2INT(rb_funcall(value, rb_intern("min"), 0));
|
64
|
-
int second = NUM2INT(rb_funcall(value, rb_intern("sec"), 0));
|
65
|
-
data[key] = Exiv2::TimeValue(hour, minute, second);
|
66
|
-
return true;
|
67
|
-
}
|
68
|
-
|
69
|
-
case Exiv2::invalid6:
|
70
|
-
case Exiv2::comment:
|
71
|
-
case Exiv2::directory:
|
72
|
-
case Exiv2::lastTypeId:
|
73
|
-
{
|
74
|
-
data[key] = std::string(STR(value));
|
75
|
-
return true;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
return false;
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
/*
|
85
|
-
* Access exif tag by name
|
86
|
-
*
|
87
|
-
* <code>Exiv2::Image.new("a.jpg").exif["Exif.Image.Model"] => "FinePixS2Pro"</code>
|
88
|
-
*/
|
89
|
-
static VALUE exiv2_exif_get(VALUE self, VALUE key) {
|
90
|
-
__BEGIN
|
91
|
-
rbImage* image;
|
92
|
-
Data_Get_Struct(self, rbImage, image);
|
93
|
-
|
94
|
-
VALUE strkey = rb_funcall(key, rb_intern("to_s"), 0);
|
95
|
-
Exiv2::ExifData &exifData = image->image->exifData();
|
96
|
-
|
97
|
-
if(exifData.empty()) {
|
98
|
-
return Qnil;
|
99
|
-
}
|
100
|
-
|
101
|
-
Exiv2::ExifKey exifKey(STR(strkey));
|
102
|
-
Exiv2::ExifData::const_iterator pos = exifData.findKey(exifKey);
|
103
|
-
if (pos == exifData.end()) {
|
104
|
-
return Qnil;
|
105
|
-
}
|
106
|
-
|
107
|
-
return unmarshall_value(pos->value());
|
108
|
-
__NIL_END
|
109
|
-
}
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
/*
|
114
|
-
* @exif["Exif.Photo.PixelXDimension"] = 3024
|
115
|
-
* [] — is a universal accessor
|
116
|
-
*/
|
117
|
-
static VALUE exiv2_exif_set(VALUE self, VALUE key, VALUE value) {
|
118
|
-
__BEGIN
|
119
|
-
rbImage* image;
|
120
|
-
Data_Get_Struct(self, rbImage, image);
|
121
|
-
|
122
|
-
VALUE strkey = rb_funcall(key, rb_intern("to_s"), 0);
|
123
|
-
|
124
|
-
if(!marshall_value(image->image->exifData(), STR(strkey), value)) {
|
125
|
-
THROW("Couldn't write %s", STR(strkey));
|
126
|
-
}
|
127
|
-
|
128
|
-
image->dirty = true;
|
129
|
-
return value;
|
130
|
-
__NIL_END
|
131
|
-
}
|
132
|
-
|
133
|
-
/*
|
134
|
-
* Iterates through all exif tags in image
|
135
|
-
*/
|
136
|
-
static VALUE exiv2_exif_each(int argc, VALUE *argv, VALUE self) {
|
137
|
-
__BEGIN
|
138
|
-
rbImage* image;
|
139
|
-
Data_Get_Struct(self, rbImage, image);
|
140
|
-
|
141
|
-
VALUE prefix;
|
142
|
-
rb_scan_args(argc, argv, "01", &prefix);
|
143
|
-
|
144
|
-
Exiv2::ExifData &exifData = image->image->exifData();
|
145
|
-
if(exifData.empty()) {
|
146
|
-
return Qnil;
|
147
|
-
}
|
148
|
-
|
149
|
-
Exiv2::ExifData::const_iterator end = exifData.end();
|
150
|
-
for(Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
|
151
|
-
VALUE key = rb_str_new(i->key().c_str(), i->key().length());
|
152
|
-
VALUE val = unmarshall_value(i->value());
|
153
|
-
//VALUE val = rb_str_new(i->toString().c_str(), i->toString().length());
|
154
|
-
if(prefix != Qnil && INT2FIX(0) != rb_funcall(key, rb_intern("index"), 1, prefix)) {
|
155
|
-
continue;
|
156
|
-
}
|
157
|
-
rb_yield(rb_ary_new3(2, key, val));
|
158
|
-
}
|
159
|
-
return self;
|
160
|
-
__END
|
161
|
-
}
|
162
|
-
|
163
|
-
/*
|
164
|
-
* Delete exif value by it's name
|
165
|
-
*/
|
166
|
-
static VALUE exiv2_exif_delete(VALUE self, VALUE key) {
|
167
|
-
__BEGIN
|
168
|
-
rbImage* image;
|
169
|
-
Data_Get_Struct(self, rbImage, image);
|
170
|
-
|
171
|
-
VALUE strkey = rb_funcall(key, rb_intern("to_s"), 0);
|
172
|
-
Exiv2::ExifData &exifData = image->image->exifData();
|
173
|
-
|
174
|
-
if(exifData.empty()) {
|
175
|
-
return Qnil;
|
176
|
-
}
|
177
|
-
|
178
|
-
Exiv2::ExifKey exifKey(STR(strkey));
|
179
|
-
Exiv2::ExifData::iterator pos = exifData.findKey(exifKey);
|
180
|
-
if (pos == exifData.end()) {
|
181
|
-
return Qnil;
|
182
|
-
}
|
183
|
-
|
184
|
-
std::string v = pos->toString();
|
185
|
-
exifData.erase(pos);
|
186
|
-
return rb_str_new(v.c_str(), v.length());
|
187
|
-
__NIL_END
|
188
|
-
}
|
189
|
-
|
190
|
-
/*
|
191
|
-
* Clear all exif data in image
|
192
|
-
*/
|
193
|
-
static VALUE exiv2_exif_clear(VALUE self) {
|
194
|
-
__BEGIN
|
195
|
-
rbImage* image;
|
196
|
-
Data_Get_Struct(self, rbImage, image);
|
197
|
-
|
198
|
-
Exiv2::ExifData &exifData = image->image->exifData();
|
199
|
-
|
200
|
-
if(exifData.empty()) {
|
201
|
-
return Qnil;
|
202
|
-
}
|
203
|
-
exifData.clear();
|
204
|
-
return self;
|
205
|
-
__END
|
206
|
-
}
|
207
|
-
|
208
|
-
/*
|
209
|
-
* Count of exif tags in image
|
210
|
-
*/
|
211
|
-
static VALUE exiv2_exif_count(VALUE self) {
|
212
|
-
__BEGIN
|
213
|
-
rbImage* image;
|
214
|
-
Data_Get_Struct(self, rbImage, image);
|
215
|
-
|
216
|
-
Exiv2::ExifData &exifData = image->image->exifData();
|
217
|
-
|
218
|
-
return INT2FIX(exifData.count());
|
219
|
-
__END
|
220
|
-
}
|
221
|
-
|
222
|
-
/*
|
223
|
-
* Predicate method. Is exif empty?
|
224
|
-
*/
|
225
|
-
static VALUE exiv2_exif_empty(VALUE self) {
|
226
|
-
__BEGIN
|
227
|
-
rbImage* image;
|
228
|
-
Data_Get_Struct(self, rbImage, image);
|
229
|
-
|
230
|
-
Exiv2::ExifData &exifData = image->image->exifData();
|
231
|
-
|
232
|
-
return exifData.empty() ? Qtrue : Qfalse;
|
233
|
-
__NIL_END
|
234
|
-
}
|
235
|
-
|
236
|
-
|
237
|
-
#ifdef HAVE_IFDTAGLIST
|
238
|
-
static void tag_leave(Exiv2::TagInfo* info) {
|
239
|
-
|
240
|
-
}
|
241
|
-
|
242
|
-
static VALUE create_exiv2_tag(Exiv2::TagInfo* info) {
|
243
|
-
return Data_Wrap_Struct(cTag, 0, tag_leave, info);
|
244
|
-
}
|
245
|
-
|
246
|
-
static int iterate_tag_collection(const Exiv2::TagInfo* collection, bool to_yield = true) {
|
247
|
-
Exiv2::TagInfo* _collection = const_cast<Exiv2::TagInfo *>(collection);
|
248
|
-
int i;
|
249
|
-
for (i=0; _collection[i].tag_ != 0xffff; ++i) {
|
250
|
-
if(to_yield) {
|
251
|
-
rb_yield(create_exiv2_tag(_collection + i));
|
252
|
-
}
|
253
|
-
}
|
254
|
-
return i;
|
255
|
-
}
|
256
|
-
|
257
|
-
/*
|
258
|
-
* Iterates through all available exif tags, that can be set in the image
|
259
|
-
*/
|
260
|
-
static VALUE exiv2_tags_each(VALUE self) {
|
261
|
-
__BEGIN
|
262
|
-
iterate_tag_collection(Exiv2::ExifTags::ifdTagList());
|
263
|
-
iterate_tag_collection(Exiv2::ExifTags::exifTagList());
|
264
|
-
iterate_tag_collection(Exiv2::ExifTags::iopTagList());
|
265
|
-
iterate_tag_collection(Exiv2::ExifTags::gpsTagList());
|
266
|
-
return self;
|
267
|
-
__END
|
268
|
-
}
|
269
|
-
|
270
|
-
|
271
|
-
/*
|
272
|
-
* Count of all available exif tags
|
273
|
-
*/
|
274
|
-
static VALUE exiv2_tags_count(VALUE self) {
|
275
|
-
__BEGIN
|
276
|
-
return INT2NUM(
|
277
|
-
iterate_tag_collection(Exiv2::ExifTags::ifdTagList(), false) +
|
278
|
-
iterate_tag_collection(Exiv2::ExifTags::exifTagList(), false) +
|
279
|
-
iterate_tag_collection(Exiv2::ExifTags::iopTagList(), false) +
|
280
|
-
iterate_tag_collection(Exiv2::ExifTags::gpsTagList(), false)
|
281
|
-
);
|
282
|
-
__END
|
283
|
-
}
|
284
|
-
#endif /* HAVE_IFDTAGLIST */
|
285
|
-
|
286
|
-
/*
|
287
|
-
* Name of exif tag
|
288
|
-
*/
|
289
|
-
static VALUE exiv2_tag_name(VALUE self) {
|
290
|
-
__BEGIN
|
291
|
-
Exiv2::TagInfo* tag;
|
292
|
-
Data_Get_Struct(self, Exiv2::TagInfo, tag);
|
293
|
-
|
294
|
-
return tag->name_ ? rb_str_new2(tag->name_) : Qnil;
|
295
|
-
__END
|
296
|
-
}
|
297
|
-
|
298
|
-
/*
|
299
|
-
* title of exif tag
|
300
|
-
*/
|
301
|
-
static VALUE exiv2_tag_title(VALUE self) {
|
302
|
-
__BEGIN
|
303
|
-
Exiv2::TagInfo* tag;
|
304
|
-
Data_Get_Struct(self, Exiv2::TagInfo, tag);
|
305
|
-
|
306
|
-
return tag->title_ ? rb_str_new2(tag->title_) : Qnil;
|
307
|
-
__END
|
308
|
-
}
|
309
|
-
|
310
|
-
/*
|
311
|
-
* description of exif tag
|
312
|
-
*/
|
313
|
-
static VALUE exiv2_tag_desc(VALUE self) {
|
314
|
-
__BEGIN
|
315
|
-
Exiv2::TagInfo* tag;
|
316
|
-
Data_Get_Struct(self, Exiv2::TagInfo, tag);
|
317
|
-
|
318
|
-
return tag->desc_ ? rb_str_new2(tag->desc_) : Qnil;
|
319
|
-
__END
|
320
|
-
}
|
321
|
-
|
322
|
-
/*
|
323
|
-
* section of exif tag
|
324
|
-
*/
|
325
|
-
static VALUE exiv2_tag_section(VALUE self) {
|
326
|
-
__BEGIN
|
327
|
-
Exiv2::TagInfo* tag;
|
328
|
-
Data_Get_Struct(self, Exiv2::TagInfo, tag);
|
329
|
-
|
330
|
-
return rb_str_new2(Exiv2::ExifTags::sectionName(tag->sectionId_));
|
331
|
-
__END
|
332
|
-
}
|
333
|
-
|
334
|
-
/*
|
335
|
-
* IFD of exif tag
|
336
|
-
*/
|
337
|
-
static VALUE exiv2_tag_ifd(VALUE self) {
|
338
|
-
__BEGIN
|
339
|
-
Exiv2::TagInfo* tag;
|
340
|
-
Data_Get_Struct(self, Exiv2::TagInfo, tag);
|
341
|
-
|
342
|
-
return rb_str_new2(Exiv2::ExifTags::ifdName(tag->ifdId_));
|
343
|
-
__END
|
344
|
-
}
|
345
|
-
|
346
|
-
|
347
|
-
void Init_exif() {
|
348
|
-
cExif = rb_define_class_under(mExiv2, "Exif", rb_cObject);
|
349
|
-
rb_define_method(cExif, "each", VALUEFUNC(exiv2_exif_each), -1);
|
350
|
-
rb_define_method(cExif, "[]", VALUEFUNC(exiv2_exif_get), 1);
|
351
|
-
rb_define_method(cExif, "[]=", VALUEFUNC(exiv2_exif_set), 2);
|
352
|
-
rb_define_method(cExif, "delete", VALUEFUNC(exiv2_exif_delete), 1);
|
353
|
-
rb_define_method(cExif, "clear", VALUEFUNC(exiv2_exif_clear), 0);
|
354
|
-
rb_define_method(cExif, "count", VALUEFUNC(exiv2_exif_count), 0);
|
355
|
-
rb_define_method(cExif, "empty?", VALUEFUNC(exiv2_exif_empty), 0);
|
356
|
-
// rb_define_singleton_method(cExif, "iptc_tags_each", VALUEFUNC(exiv2_iptc_tags_each), 0);
|
357
|
-
|
358
|
-
cTag = rb_define_class_under(mExiv2, "Tag", rb_cObject);
|
359
|
-
#ifdef HAVE_IFDTAGLIST
|
360
|
-
rb_define_singleton_method(cTag, "each", VALUEFUNC(exiv2_tags_each), 0);
|
361
|
-
rb_define_singleton_method(cTag, "count", VALUEFUNC(exiv2_tags_count), 0);
|
362
|
-
#endif /* HAVE_IFDTAGLIST */
|
363
|
-
|
364
|
-
rb_define_method(cTag, "ifd", VALUEFUNC(exiv2_tag_ifd), 0);
|
365
|
-
rb_define_method(cTag, "section", VALUEFUNC(exiv2_tag_section), 0);
|
366
|
-
rb_define_method(cTag, "name", VALUEFUNC(exiv2_tag_name), 0);
|
367
|
-
rb_define_method(cTag, "title", VALUEFUNC(exiv2_tag_title), 0);
|
368
|
-
rb_define_method(cTag, "desc", VALUEFUNC(exiv2_tag_desc), 0);
|
369
|
-
}
|
data/ext/exiv2.cpp
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
// ***************************************************************** -*- C++ -*-
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2006 Max Lapshin <max@maxidoors.ru>
|
4
|
-
*
|
5
|
-
* This program is part of the ruby-exiv2 distribution.
|
6
|
-
*
|
7
|
-
* This program is free software; you can redistribute it and/or
|
8
|
-
* modify it under the terms of the GNU General Public License
|
9
|
-
* as published by the Free Software Foundation; either version 2
|
10
|
-
* of the License, or (at your option) any later version.
|
11
|
-
*
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
-
* GNU General Public License for more details.
|
16
|
-
*
|
17
|
-
* You should have received a copy of the GNU General Public License
|
18
|
-
* along with this program; if not, write to the Free Software
|
19
|
-
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
20
|
-
*/
|
21
|
-
/*
|
22
|
-
Abstract: Driver for using exiv2 library (http://www.exiv2.org/) in ruby language
|
23
|
-
|
24
|
-
File: exiv2.cpp
|
25
|
-
Version: $Rev: 1 $
|
26
|
-
Author(s): Max Lapshin <max@maxidoors.ru>
|
27
|
-
*/
|
28
|
-
// *****************************************************************************
|
29
|
-
#include "exiv2.hpp"
|
30
|
-
|
31
|
-
|
32
|
-
VALUE mExiv2, cImage, cExif, cTag, cIptc, cThumbnail, eError;
|
33
|
-
|
34
|
-
void rb_exiv2_throw(const char *file, long unsigned int line, const char *fmt, ...) {
|
35
|
-
char* message;
|
36
|
-
va_list ap;
|
37
|
-
va_start(ap, fmt);
|
38
|
-
vasprintf(&message, fmt, ap);
|
39
|
-
va_end(ap);
|
40
|
-
|
41
|
-
char error_message[strlen(message) + 80];
|
42
|
-
snprintf(error_message, sizeof(error_message), "%s. File: %s, line: %lu", message, file, line);
|
43
|
-
free(message);
|
44
|
-
rb_raise(eError, error_message);
|
45
|
-
}
|
46
|
-
|
47
|
-
|
48
|
-
#ifdef __cplusplus
|
49
|
-
extern "C"
|
50
|
-
#endif
|
51
|
-
|
52
|
-
/*
|
53
|
-
* Document-module: Exiv2
|
54
|
-
*
|
55
|
-
* Namespace for all exiv stuff
|
56
|
-
*/
|
57
|
-
|
58
|
-
/*
|
59
|
-
* Document-class: Exiv2::Error
|
60
|
-
* error, thrown if anything goes wrong inside in exiv2
|
61
|
-
*/
|
62
|
-
|
63
|
-
void Init_exiv2_bin() {
|
64
|
-
mExiv2 = rb_define_module("Exiv2");
|
65
|
-
|
66
|
-
eError = rb_define_class_under(mExiv2, "Error", rb_eStandardError);
|
67
|
-
|
68
|
-
Init_image();
|
69
|
-
Init_exif();
|
70
|
-
Init_iptc();
|
71
|
-
//cThumbnail = rb_define_class_under(mExiv2, "Thumbnail", rb_cObject);
|
72
|
-
//rb_define_method(cThumbnail, "extension", VALUEFUNC(exiv2_thumb_ext), 0);
|
73
|
-
//rb_define_method(cThumbnail, "format", VALUEFUNC(exiv2_thumb_format), 0);
|
74
|
-
//rb_define_method(cThumbnail, "clear", VALUEFUNC(exiv2_thumb_clear), 0);
|
75
|
-
//rb_define_method(cThumbnail, "to_s", VALUEFUNC(exiv2_thumb_read), 0);
|
76
|
-
//rb_define_method(cThumbnail, "read", VALUEFUNC(exiv2_thumb_read), 0);
|
77
|
-
//rb_define_method(cThumbnail, "write", VALUEFUNC(exiv2_thumb_write), 1);
|
78
|
-
}
|
data/ext/extconf.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "mkmf"
|
4
|
-
require 'optparse'
|
5
|
-
CONFIG["CPP"] = "g++ -E "
|
6
|
-
CONFIG["CC"] = "g++ "
|
7
|
-
CONFIG["LDSHARED"].gsub!(/^cc /,"g++ ")
|
8
|
-
|
9
|
-
|
10
|
-
$CPPFLAGS << " -Wall -I/usr/include/exiv2 "
|
11
|
-
$LDFLAGS << " -lstdc++ "
|
12
|
-
|
13
|
-
OptionParser.new do |opts|
|
14
|
-
opts.on("-E PATH", "--exiv2-dir=PATH", "Prefix, where libexiv2 is installed: /usr/local") do |path|
|
15
|
-
$LDFLAGS << "-L" + path + "/lib "
|
16
|
-
$CPPFLAGS << "-I" + path + "/include "
|
17
|
-
$CPPFLAGS << "-I" + path + "/include/exiv2 "
|
18
|
-
end
|
19
|
-
opts.parse!(ARGV.include?("--") ? ARGV[ARGV.index("--")+1..-1] : ARGV.clone)
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
have_header "exif.hpp"
|
24
|
-
|
25
|
-
|
26
|
-
image_factory_open = "Exiv2::ImageFactory::open"
|
27
|
-
def image_factory_open.upcase
|
28
|
-
"IMGFACTORYOPEN"
|
29
|
-
end
|
30
|
-
have_library "exiv2", image_factory_open do <<-SRC
|
31
|
-
#include <image.hpp>
|
32
|
-
#include <exif.hpp>
|
33
|
-
|
34
|
-
|
35
|
-
#include <string>
|
36
|
-
#include <vector>
|
37
|
-
#include <iostream>
|
38
|
-
#include <fstream>
|
39
|
-
#include <iomanip>
|
40
|
-
#include <cstring>
|
41
|
-
#include <cassert>
|
42
|
-
|
43
|
-
#include <stdarg.h>
|
44
|
-
int main(void) {
|
45
|
-
#{image_factory_open}("a");
|
46
|
-
}
|
47
|
-
SRC
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
ifd_tag_list = "Exiv2::ExifTags::ifdTagList"
|
52
|
-
def ifd_tag_list.upcase
|
53
|
-
"IFDTAGLIST"
|
54
|
-
end
|
55
|
-
have_func ifd_tag_list do <<-SRC
|
56
|
-
#include <image.hpp>
|
57
|
-
#include <exif.hpp>
|
58
|
-
|
59
|
-
|
60
|
-
#include <string>
|
61
|
-
#include <vector>
|
62
|
-
#include <iostream>
|
63
|
-
#include <fstream>
|
64
|
-
#include <iomanip>
|
65
|
-
#include <cstring>
|
66
|
-
#include <cassert>
|
67
|
-
|
68
|
-
#include <stdarg.h>
|
69
|
-
int main(void) {
|
70
|
-
#{ifd_tag_list}();
|
71
|
-
}
|
72
|
-
SRC
|
73
|
-
end
|
74
|
-
create_makefile 'exiv2_bin'
|
75
|
-
|