From f9c5eaf5804611e0f163bd835071203b0e39adb1 Mon Sep 17 00:00:00 2001 From: clanmills Date: Sun, 22 Mar 2020 20:44:37 +0000 Subject: [PATCH 1/5] fix_1046_pt-GPSProcessingMethod --- test/data/IMG_0246.exv | Bin 0 -> 15297 bytes tests/bugfixes/github/test_issue_1046.py | 64 +++++++++++++++++++++++ tests/bugfixes/github/test_issue_987.py | 28 ---------- 3 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 test/data/IMG_0246.exv create mode 100644 tests/bugfixes/github/test_issue_1046.py delete mode 100644 tests/bugfixes/github/test_issue_987.py diff --git a/test/data/IMG_0246.exv b/test/data/IMG_0246.exv new file mode 100644 index 0000000000000000000000000000000000000000..63d34c738c0ee3ab6194911e13b9e8a480ac68d5 GIT binary patch literal 15297 zcmeHOcR&=)lAmSCB00x(LCI+e5=D_HNy%AB;*xU|QACmmf`Cd;5D+CP83Ywfhy*1_ zPD%z5kRB%CN9wBg&@?wU!ap#F0L-SpD1->13i?elmrSY z1(sm1_BlobBO)V$0lz3w5g9RY8BtN_Fq9m!>vJJ+B5el-{4kv)tLFm#g$ zg1HDrOayszcPuY}KK>qV0~isvtAhaJ!;9OsKMu>|NpT*12N*AYSH1%G-IH$vOt2>> zL_!cz{H_lK;Cdu`7>+yXo(?(Cxfo9bjnhLAJ-}fA6N4ddG66T^@gN|A#6=(|?iU>Y z3x?A7#v&>rf=K^!9`W`t3QQDo4>M8#-_m#Ig%!*T`GZ~m@d2jT!(;$cKKOG^8GgY~ zCJ}Dzuuq7rT^#@+yk9W#7mS~^Yo8X_B>Y7#l7)w}1NVgsJj15}p#YHr`m0&~D;drY zp#K373XtO-2Miat{dxoq1Wf{E4sazTgaNHL!So}+54;MNzz06SXn;2XCWP=H&;dFQ zri=(+Ffoumz{Efc_SEMzHFOZ*DPYk7$SL>a5JZPhvuBf>4uTkAZSYGEFcXl&ePLqV z!vI2T0K=<+9$bWd-wpyoZ~(b7kV^tN8sJX=*8SFd4P`s1YgSsU?~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Zty{qmfij5ze9h%r&)Kx#Sco*a5_w{-|X+VCg;Dc+(M#BlV=ltmGgor8S zLkE(Np2nk5@4OPD)_6}QptJ1xQ;m~y^_PzsJhoHHe+LEbQVbWM%7WZ6{>o>MZPM#fQOx4fVRF(fTNAHEn49i zO3qKl&)Ln{&dUnr=j`O-DdQ)P#u=9Z7#0hoQ8*PZM|rfd)@js9SMb-@;zHs=B7(U8 zcR>Ri9=7LYbd^;0EP$Fkde2o~Utb|#F(FqEdtp&&X=z~*j4%cx2s8ve{aw7Q`~+P* zIrl9n*?HP{VBNgnKkJ4qT3Ne#d2^>-a}cKgHZUq%2{bd%Aw^1`~<%cDim!oV}( zJ=b9P$4HO;`~L>>yY+Vjen;SU1b#>0cLaV%;QwR<{(M)ma{(_%zTi!0r{`Y)orDnU literal 0 HcmV?d00001 diff --git a/tests/bugfixes/github/test_issue_1046.py b/tests/bugfixes/github/test_issue_1046.py new file mode 100644 index 00000000..3f141bf5 --- /dev/null +++ b/tests/bugfixes/github/test_issue_1046.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- + +from system_tests import CaseMeta, CopyFiles, path +@CopyFiles("$data_path/IMG_0246.exv") + +class test_issue_1046Test(metaclass=CaseMeta): + + filename = path("$data_path/IMG_0246_copy.exv") + commands = ["$exiv2 -pt -g GPSInfo -g UserCom $filename" + ,"$exiv2 -pv -g GPSInfo -g UserCom $filename" + ,"$exiv2 -M'set Exif.Photo.UserComment charset=Ascii how now brown cow' $filename" + ,"$exiv2 -pt -g UserComment $filename" + ,"$exiv2 -pv -g UserComment $filename" + ,"$exiv2 -M'set Exif.Photo.UserComment charset=Unicode \u0041\u0042' $filename" + ,"$exiv2 -pt -g UserComment $filename" + ,"$exiv2 -pv -g UserComment $filename" + ,"$exiv2 -M'set Exif.Photo.UserComment hello world' $filename" + ,"$exiv2 -pt -g UserComment $filename" + ,"$exiv2 -pv -g UserComment $filename" + ,"$exiv2 -M'set Exif.GPSInfo.GPSProcessingMethod charset=Unicode \u0052\u006f\u0062\u0069\u006e' $filename" + ,"$exiv2 -M'set Exif.GPSInfo.GPSAreaInformation charset=Ascii area information' $filename" + ,"$exiv2 -pt -g GPSPro -g GPSArea $filename" + ,"$exiv2 -pv -g GPSPro -g GPSArea $filename" + ] + stdout = ["""Exif.Photo.UserComment Undefined 12 AB +Exif.GPSInfo.GPSVersionID Byte 4 2.2.0.0 +Exif.GPSInfo.GPSLatitudeRef Ascii 2 North +Exif.GPSInfo.GPSLatitude Rational 3 51deg 23' 13" +Exif.GPSInfo.GPSLongitudeRef Ascii 2 West +Exif.GPSInfo.GPSLongitude Rational 3 0deg 44' 27" +Exif.GPSInfo.GPSAltitudeRef Byte 1 Above sea level +Exif.GPSInfo.GPSAltitude Rational 1 104.2 m +Exif.GPSInfo.GPSTimeStamp Rational 3 10:34:11 +Exif.GPSInfo.GPSMapDatum Ascii 7 WGS-84 +Exif.GPSInfo.GPSProcessingMethod Undefined 18 HYBRID-FIX +Exif.GPSInfo.GPSAreaInformation Undefined 23 Surrey, England +Exif.GPSInfo.GPSDateStamp Ascii 20 2020:02:02 10:34:11 +""","""0x9286 Photo UserComment Undefined 12 charset="Unicode" AB +0x0000 GPSInfo GPSVersionID Byte 4 2 2 0 0 +0x0001 GPSInfo GPSLatitudeRef Ascii 2 N +0x0002 GPSInfo GPSLatitude Rational 3 51/1 23/1 13/1 +0x0003 GPSInfo GPSLongitudeRef Ascii 2 W +0x0004 GPSInfo GPSLongitude Rational 3 0/1 44/1 27/1 +0x0005 GPSInfo GPSAltitudeRef Byte 1 0 +0x0006 GPSInfo GPSAltitude Rational 1 10420/100 +0x0007 GPSInfo GPSTimeStamp Rational 3 10/1 34/1 11/1 +0x0012 GPSInfo GPSMapDatum Ascii 7 WGS-84 +0x001b GPSInfo GPSProcessingMethod Undefined 18 charset="Ascii" HYBRID-FIX +0x001c GPSInfo GPSAreaInformation Undefined 23 Surrey, England +0x001d GPSInfo GPSDateStamp Ascii 20 2020:02:02 10:34:11 +""","","""Exif.Photo.UserComment Undefined 25 how now brown cow +""","""0x9286 Photo UserComment Undefined 25 charset="Ascii" how now brown cow +""","","""Exif.Photo.UserComment Undefined 12 AB +""","""0x9286 Photo UserComment Undefined 12 charset="Unicode" AB +""","","""Exif.Photo.UserComment Undefined 19 hello world +""","""0x9286 Photo UserComment Undefined 19 hello world +""","","","""Exif.GPSInfo.GPSProcessingMethod Undefined 18 Robin +Exif.GPSInfo.GPSAreaInformation Undefined 24 area information +""","""0x001b GPSInfo GPSProcessingMethod Undefined 18 charset="Unicode" Robin +0x001c GPSInfo GPSAreaInformation Undefined 24 charset="Ascii" area information +""" + ] + stderr = [""]*len(commands) + retval = [ 0]*len(commands) diff --git a/tests/bugfixes/github/test_issue_987.py b/tests/bugfixes/github/test_issue_987.py deleted file mode 100644 index 397f7a81..00000000 --- a/tests/bugfixes/github/test_issue_987.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from system_tests import CaseMeta, path -import zlib - -class tagListTest(metaclass=CaseMeta): - def compare_stdout(self, i, command, got_stdout, expected_stdout): - lines = got_stdout.split('\n') - count = len(lines); - checksum = zlib.adler32(got_stdout.encode()) - new_got = "%s,%s" % (count, checksum) - return super().compare_stdout(i, command, new_got, expected_stdout) - - commands = ["$taglist --help", - "$taglist all", - "$taglist ALL", - "$taglist Groups", - "$taglist nothing", - ] - stdout = ["8,198867862", - "5426,1072295739", - "5426,838787056", - "107,430791180", - "8,198867862", - ] - - stderr = ["","","","","Unexpected argument nothing\n"] - retval = [ 0,0, 0, 0, 2] From db1be4ae8e1077949fcb6a960e93069d6a41b395 Mon Sep 17 00:00:00 2001 From: clanmills Date: Sun, 22 Mar 2020 20:56:38 +0000 Subject: [PATCH 2/5] fix_1046_pt-GPSProcessingMethod --- man/man1/exiv2.1 | 38 ++++++++++++++----- src/actions.cpp | 10 ++++- src/tags_int.cpp | 44 +++++++--------------- src/tiffcomposite_int.cpp | 25 ++++++++++-- test/data/IMG_0246.exv | Bin 15297 -> 15081 bytes test/data/geotag-test.out | 12 +++--- tests/bugfixes/redmine/test_issue_1024.py | 4 +- tests/bugfixes/redmine/test_issue_1137.py | 4 +- tests/bugfixes/redmine/test_issue_528.py | 4 +- 9 files changed, 86 insertions(+), 55 deletions(-) diff --git a/man/man1/exiv2.1 b/man/man1/exiv2.1 index 304b51ef..19d3bc76 100644 --- a/man/man1/exiv2.1 +++ b/man/man1/exiv2.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH EXIV2 1 "Aug 25, 2019" +.TH EXIV2 1 "March 22, 2020" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -533,14 +533,34 @@ The value is optional. Not providing any value is equivalent to an empty value ("") and is mainly useful to create an XMP array property, e.g., a bag. .sp 1 -The format of Exif \fBComment\fP values includes an optional charset -specification at the beginning: -.br -.B [charset=Ascii|Jis|Unicode|Undefined ]\fIcomment\fP +The format of Exif \fBComment\fP values include an optional charset +specification at the beginning. Comments are used by the tags Exif.Photo.UserComment, Exif.GPSInfo.GPSProcessingMethod +and Exif.GPSInfo.GPSAreaInformation. Comments are stored as Undefined tags with an 8 byte encoding +definition follow by the encoded data. The charset is specified as follows: .sp 1 -.B Undefined -is used by default if the value doesn't start with a charset -definition. +.B [charset=Ascii|Jis|Unicode|Undefined] \fIcomment\fP +.br +charset=Undefined is the default +.sp 1 +.nf +$ exiv2 -M'set Exif.Photo.UserComment charset=Ascii My photo' x.jpg +$ exiv2 -pa --grep UserComment x.jpg +Exif.Photo.UserComment Undefined 16 My photo +$ exiv2 -pv --grep UserComment x.jpg +0x9286 Photo UserComment Undefined 16 charset="Ascii" My photo + +$ exiv2 -M'set Exif.Photo.UserComment charset=Unicode \\u0052\\u006f\\u0062\\u0069\\u006e' x.jpg +$ exiv2 -pa --grep UserComment x.jpg +Exif.Photo.UserComment Undefined 18 Robin +$ exiv2 -pv --grep UserComment x.jpg +0x9286 Photo UserComment Undefined 18 charset="Unicode" Robin + +$ exiv2 -M'set Exif.GPSInfo.GPSProcessingMethod HYBRID-FIX' x.jpg +$ exiv2 -pa --grep ProcessingMethod x.jpg +Exif.GPSInfo.GPSProcessingMethod Undefined 18 HYBRID-FIX +$ exiv2 -pv --grep ProcessingMethod x.jpg +0x001b GPSInfo GPSProcessingMethod Undefined 18 HYBRID-FIX +.fi .sp 1 The format for an IPTC \fBDate\fP value is: .sp 1 @@ -661,7 +681,7 @@ Type Explanation The printing flag t = translated and is intended for human use. Scripts should never use translated values as they are localised and the format may change as Exiv2 evolves. The printing flag v reports the values recorded in the metadata and should be used by scripts. .ne 40 .SH CONFIGURATION FILE -Exiv2 can read an optional configuration file ~/.exiv2 on Unix systems and %USERPROFILE%\\exiv2.ini on Windows (using a Visual Studio build). Cygwin and MinGW/msys2 follow the unix convention and use ~/.exiv2 You can fine the location of the configuration file with the command: +Exiv2 can read an optional configuration file ~/.exiv2 on Unix systems and %USERPROFILE%\\exiv2.ini on Windows (using a Visual Studio build). Cygwin and MinGW/msys2 follow the unix convention and use ~/.exiv2 You can determine the location of the configuration file with the command: .br .sp 1 .nf diff --git a/src/actions.cpp b/src/actions.cpp index ff9f28b0..826d9e8b 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -696,7 +696,15 @@ namespace Action { return true; } bool done = false; - if (0 == strcmp(md.key().c_str(), "Exif.Photo.UserComment")) { + // handle `comment` typeIDs + // $ bin/taglist | grep '\tComment,' | cut -d, -f 5 + // Exif.Photo.UserComment + // Exif.GPSInfo.GPSProcessingMethod + // Exif.GPSInfo.GPSAreaInformation + if( md.key() == "Exif.Photo.UserComment" + || md.key() == "Exif.GPSInfo.GPSProcessingMethod" + || md.key() == "Exif.GPSInfo.GPSAreaInformation" + ) { const Exiv2::CommentValue* pcv = dynamic_cast(&md.value()); if (pcv) { Exiv2::CommentValue::CharsetId csId = pcv->charsetId(); diff --git a/src/tags_int.cpp b/src/tags_int.cpp index add81946..8688d26f 100644 --- a/src/tags_int.cpp +++ b/src/tags_int.cpp @@ -1908,13 +1908,12 @@ namespace Exiv2 { gpsId, gpsTags, unsignedRational, 1, printValue), TagInfo(0x001b, "GPSProcessingMethod", N_("GPS Processing Method"), N_("A character string recording the name of the method used for location finding. " - "The first byte indicates the character code used, and this is followed by the name " - "of the method."), - gpsId, gpsTags, undefined, 0, printValue), + "The string encoding is defined using the same scheme as UserComment."), + gpsId, gpsTags, comment, 0, print0x9286), TagInfo(0x001c, "GPSAreaInformation", N_("GPS Area Information"), - N_("A character string recording the name of the GPS area. The first byte indicates " - "the character code used, and this is followed by the name of the GPS area."), - gpsId, gpsTags, undefined, 0, printValue), + N_("A character string recording the name of the GPS area." + "The string encoding is defined using the same scheme as UserComment."), + gpsId, gpsTags, comment, 0, print0x9286), TagInfo(0x001d, "GPSDateStamp", N_("GPS Date Stamp"), N_("A character string recording date and time information relative to UTC " "(Coordinated Universal Time). The format is \"YYYY:MM:DD.\"."), @@ -2229,38 +2228,23 @@ namespace Exiv2 { std::ostream& printFloat(std::ostream& os, const Value& value, const ExifData*) { Rational r = value.toRational(); - if (r.second != 0) return os << static_cast(r.first) / r.second; - return os << "(" << value << ")"; + if (r.second != 0) { + os << value.toFloat() ; + } else { + os << "(" << value << ")"; + } + return os; } // printFloat std::ostream& printDegrees(std::ostream& os, const Value& value, const ExifData*) { std::ios::fmtflags f( os.flags() ); if (value.count() == 3) { - std::ostringstream oss; - oss.copyfmt(os); static const char* unit[] = { "deg", "'", "\"" }; - static const int prec[] = { 7, 5, 3 }; - int n; - for (n = 2; n > 0; --n) { - if (value.toRational(n).first != 0) break; + for (int i = 0; i < value.count() ; ++i) { + const int v = (int) (value.toFloat(i)+0.5f); // nearest integer + os << (i != 0? " " : "") << v << unit[i]; } - for (int i = 0; i < n + 1; ++i) { - const uint32_t z = (uint32_t) value.toRational(i).first; - const uint32_t d = (uint32_t) value.toRational(i).second; - if (d == 0) - { - os << "(" << value << ")"; - os.flags(f); - return os; - } - // Hack: Need Value::toDouble - double b = static_cast(z)/d; - const int p = z % d == 0 ? 0 : prec[i]; - os << std::fixed << std::setprecision(p) << b - << unit[i] << " "; - } - os.copyfmt(oss); } else { os << value; diff --git a/src/tiffcomposite_int.cpp b/src/tiffcomposite_int.cpp index 8c792c00..a6bf925b 100644 --- a/src/tiffcomposite_int.cpp +++ b/src/tiffcomposite_int.cpp @@ -1836,14 +1836,33 @@ namespace Exiv2 { return len; } // TiffImageEntry::doSizeImage + static const TagInfo* findTagInfo(uint16_t tag,IfdId group) + { + const TagInfo* result = NULL ; + const TagInfo* tags = group == exifId ? Internal::exifTagList() + : group == gpsId ? Internal::gpsTagList() + : NULL + ; + if ( tags ) { + for ( size_t idx = 0; result==NULL && tags[idx].tag_ != 0xffff; ++idx) { + if ( tags[idx].tag_ == tag ) { + result = tags+idx; + } + } + } + return result; + } + // ************************************************************************* // free functions TypeId toTypeId(TiffType tiffType, uint16_t tag, IfdId group) { TypeId ti = TypeId(tiffType); - // On the fly type conversion for Exif.Photo.UserComment - if (tag == 0x9286 && group == exifId && ti == undefined) { - ti = comment; + // On the fly type conversion for Exif.Photo.UserComment, Exif.GPSProcessingMethod, GPSAreaInformation + if ( const TagInfo* pTag = ti == undefined ? findTagInfo(tag,group) : NULL ) { + if ( pTag->typeId_ == comment ) { + ti = comment; + } } // http://dev.exiv2.org/boards/3/topics/1337 change unsignedByte to signedByte // Exif.NikonAFT.AFFineTuneAdj || Exif.Pentax.Temperature diff --git a/test/data/IMG_0246.exv b/test/data/IMG_0246.exv index 63d34c738c0ee3ab6194911e13b9e8a480ac68d5..bf54ec9f0b4803cd9685f3b1f1f6eb97aaea9f38 100644 GIT binary patch delta 251 zcmX?D{<4(&Kcj0!W|`6dhlX_%xhJrNNii@qNpD=J$H>IPF!>^5l9U2agl`cm10w?i z0|$`J4`mBTP4;C9Vv>;BypSnJoIBLd)7js}mBEq0X|jm4KO@iN6lq1tH$V-{3`{`C zzz`0^EDWqbK9HU~Pg>kgMw)?v9V(&%WD5b+u>)mofNW_XO9;qz0kUO)Y;hnv49J!R zsu2OQ^Q0#~moAV1vcMp?w5TYxQb)lxFFhwQFNI-pxQrIx1&}$65U1aep4=}Z#`HjX J^Kuy}c>oOhEYSb} delta 242 zcmaD^da#`PKcj0!W|`6dhelx&xhJp%Ni#4+$!uJx$H>INIQb%Dl9UWkgl`cm10w?i z0}GJN4`uU6PxfUBViJ+wypSnJeDiG{PR7YnQofAblQX0glkNajGBYp%Ap=7=NGAg; zkk7#I1t< Date: Mon, 23 Mar 2020 08:51:46 +0000 Subject: [PATCH 3/5] Fixing Windows Build Breaker (on Appveyor 2015 and 2017). Use """ string syntax on 'set Bla.Dee.Bla' commands. --- tests/bugfixes/github/test_issue_1046.py | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/tests/bugfixes/github/test_issue_1046.py b/tests/bugfixes/github/test_issue_1046.py index 3f141bf5..0090019c 100644 --- a/tests/bugfixes/github/test_issue_1046.py +++ b/tests/bugfixes/github/test_issue_1046.py @@ -6,21 +6,22 @@ from system_tests import CaseMeta, CopyFiles, path class test_issue_1046Test(metaclass=CaseMeta): filename = path("$data_path/IMG_0246_copy.exv") - commands = ["$exiv2 -pt -g GPSInfo -g UserCom $filename" - ,"$exiv2 -pv -g GPSInfo -g UserCom $filename" - ,"$exiv2 -M'set Exif.Photo.UserComment charset=Ascii how now brown cow' $filename" - ,"$exiv2 -pt -g UserComment $filename" - ,"$exiv2 -pv -g UserComment $filename" - ,"$exiv2 -M'set Exif.Photo.UserComment charset=Unicode \u0041\u0042' $filename" - ,"$exiv2 -pt -g UserComment $filename" - ,"$exiv2 -pv -g UserComment $filename" - ,"$exiv2 -M'set Exif.Photo.UserComment hello world' $filename" - ,"$exiv2 -pt -g UserComment $filename" - ,"$exiv2 -pv -g UserComment $filename" - ,"$exiv2 -M'set Exif.GPSInfo.GPSProcessingMethod charset=Unicode \u0052\u006f\u0062\u0069\u006e' $filename" - ,"$exiv2 -M'set Exif.GPSInfo.GPSAreaInformation charset=Ascii area information' $filename" - ,"$exiv2 -pt -g GPSPro -g GPSArea $filename" - ,"$exiv2 -pv -g GPSPro -g GPSArea $filename" + # Use the """ string syntax for -M"set Bla.Dee.Bla" commands to ensure they run on Windows! + commands = [ "$exiv2 -pt -g GPSInfo -g UserCom $filename" + , "$exiv2 -pv -g GPSInfo -g UserCom $filename" + ,"""$exiv2 -M"set Exif.Photo.UserComment charset=Ascii how now brown cow" $filename""" + , "$exiv2 -pt -g UserComment $filename" + , "$exiv2 -pv -g UserComment $filename" + ,"""$exiv2 -M"set Exif.Photo.UserComment charset=Unicode \u0041\u0042" $filename""" + , "$exiv2 -pt -g UserComment $filename" + , "$exiv2 -pv -g UserComment $filename" + ,"""$exiv2 -M"set Exif.Photo.UserComment hello world" $filename""" + , "$exiv2 -pt -g UserComment $filename" + , "$exiv2 -pv -g UserComment $filename" + ,"""$exiv2 -M"set Exif.GPSInfo.GPSProcessingMethod charset=Unicode \u0052\u006f\u0062\u0069\u006e" $filename""" + ,"""$exiv2 -M"set Exif.GPSInfo.GPSAreaInformation charset=Ascii area information" $filename""" + , "$exiv2 -pt -g GPSPro -g GPSArea $filename" + , "$exiv2 -pv -g GPSPro -g GPSArea $filename" ] stdout = ["""Exif.Photo.UserComment Undefined 12 AB Exif.GPSInfo.GPSVersionID Byte 4 2.2.0.0 From b258a3ed9fc49e063b33c4a2c4f74400f8018485 Mon Sep 17 00:00:00 2001 From: clanmills Date: Mon, 23 Mar 2020 20:10:28 +0000 Subject: [PATCH 4/5] Documentation Update. Cygwin/32 and MinGW/32 platforms are obsolete. MacOS-X renamed as macOS --- README.md | 59 +++++++++++++++++-------------------------------------- 1 file changed, 18 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 71bcc0a1..250a343c 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ 3. [Unit tests](#4-3) 5. [Platform Notes](#5) 1. [Linux](#5-1) - 2. [MacOS-X](#5-2) + 2. [macOS](#5-2) 3. [MinGW](#5-3) 4. [Cygwin](#5-4) 5. [Microsoft Visual C++](#5-5) @@ -61,14 +61,14 @@ The file ReadMe.txt in a Build bundle describes how to install the library on th ## 2 Building, Installing, Using and Uninstalling Exiv2 -You need [CMake](https://cmake.org/download/) to configure the Exiv2 project and a C++11 compiler. +You need [CMake](https://cmake.org/download/) to configure the Exiv2 project and the GCC or Clang compiler and associated tool chain.
### 2.1 Build, Install, Use Exiv2 on a UNIX-like system ```bash -cd $EXIV_ROOT +cd ~/gnu/github/exiv2 # location of the project code mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . @@ -90,7 +90,7 @@ You will also need to locate libexiv2 at run time: ```bash $ export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" # Linux, Cygwin, MinGW/msys2 -$ export DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH" # MacOS-X +$ export DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH" # macOS ``` @@ -165,7 +165,7 @@ See [README-CONAN](README-CONAN.md) for more information. There are detailed platform notes about compiling and linking in `releasenotes/{platform}/ReadMe.txt` -where `platform: { CYGWIN | Darwin | Linux | MinGW | msvc }` +where `platform: { CYGWIN | macOS | Linux | MinGW | msvc }` In general you need to do the following: @@ -249,7 +249,7 @@ g++ -std=c++98 myprogram.cpp -o myprogram $(pkg-config exiv2 --libs --cflags) ### 2.8 Localisation -Localisation is supported on a UNIX-like platform: Linux, MacOS-X, Cygwin and MinGW/msys2. Localisation is not supported for Visual Studio builds. +Localisation is supported on a UNIX-like platform: Linux, macOS, Cygwin and MinGW/msys2. Localisation is not supported for Visual Studio builds. To build localisation support, use the CMake option `-DEXIV2_ENABLE_NLS=ON`. You must install the `gettext` package with your package manager or from source. The `gettext` package is available from [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) and includes the library `libintl` and utilities to build localisation files. If CMake produces error messages which mention libintl or gettext, you should verify that the package `gettext` has been correctly built and installed. @@ -515,7 +515,7 @@ $ cmake .. $ cmake --build . ``` -2) On MacOS-X +2) On macOS Apple provide clang with Xcode. GCC has not been supported by Apple since 2013. The _"normal unix build"_ uses Clang. @@ -525,7 +525,7 @@ I have been unable to get clang to work on any of those platforms. 4) Cross Compiling -I've never succeeded in getting this to work. I use different VMs for Linux 32 and 64 bit. I've documented how to set up Cygwin and MinGW/msys2 for 64 and 32 bit builds in [README-CONAN](README-CONAN.md) +I've never succeeded in getting this to work. I use different VMs for Linux 32 and 64 bit. I've documented how to set up Cygwin and MinGW/msys2 in [README-CONAN](README-CONAN.md) [TOC](#TOC)
@@ -733,9 +733,9 @@ $ make [TOC](#TOC)
-### 5.2 MacOS-X +### 5.2 macOS -You will need to install Xcode and the Xcode command-line tools to build on the Mac. +You will need to install Xcode and the Xcode command-line tools to build on macOS. You should build and install libexpat and zlib. You may use brew, macports, build from source, or use conan. @@ -746,14 +746,12 @@ I recommend that you build and install CMake from source. ### 5.3 MinGW -We provide support for both 64bit and 32bit builds using MinGW/msys2. [https://www.msys2.org](https://www.msys2.org) - -Support for MinGW/msys1.0 32 bit build was provided for Exiv2 v0.26. MinGW/msys1.0 is not supported by Team Exiv2 for Exiv2 v0.27 and later. +Please note that the platform MinGW/msys2 32 is obsolete and superceded by MinGW/msys2 64. There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575) #### MinGW/msys2 64 bit -Install: [http://repo.msys2.org/distrib/x86\_64/msys2-x86\_64-20180531.exe](http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20180531.exe) +Install: [http://repo.msys2.org/distrib/x86_64/msys2-x86\_64-20190524.exe](http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20190524.exe) I use the following batch file to start the MinGW/msys2 64 bit bash shell from the Dos Command Prompt (cmd.exe) @@ -769,23 +767,6 @@ c:\msys64\usr\bin\bash.exe -norc ``` -#### MinGW/msys2 32 bit -Install: [http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe](http://repo.msys2.org/distrib/i686/msys2-i686-20180531.exe) - -I use the following batch file to start the MinGW/msys2 32 bit bash shell from the Dos Command Prompt (cmd.exe) - -```bat -@echo off -setlocal -set "PS1=\! MSYS32:\u@\h:\w \$ " -set PATH="/usr/local/bin/:/usr/bin:/mingw32/bin:/bin:/usr/sbin:/sbin" -set "HOME=c:\msys32\home\%USERNAME%" -if NOT EXIST %HOME% mkdir %HOME% -cd %HOME% -c:\msys32\usr\bin\bash.exe -norc - -``` - #### Install MinGW Dependencies Install tools and dependencies: @@ -794,12 +775,6 @@ Install tools and dependencies: $ for i in base-devel git cmake coreutils python3 man gcc gdb make dos2unix diffutils zlib-devel libexpat-devel libiconv-devel gettext-devel; do (echo y|pacman -S $i); done ``` -You can upgrade all installed packages on your system with the following command. For me, this broke msys32 and I had to reinstall msys32 and all the dependencies. Your experience may be different. - -```bash -$ pacman -Syu -``` - #### Download exiv2 from github and build ```bash @@ -826,9 +801,11 @@ $ [TOC](#TOC)
-### 5.4 Cygwin +### 5.4 Cygwin/64 -Download: [https://cygwin.com/install.html](https://cygwin.com/install.html) and run setup-x86_64.exe for 64 Bit Cygwin, or setup-x86.exe for 32 bit Cygwin. I install into c:\\cygwin64 and c:\\cygwin32 +Please note that the platform Cygwin/32 is obsolete and superceded by Cygwin/64. + +Download: [https://cygwin.com/install.html](https://cygwin.com/install.html) and run setup-x86_64.exe. I install into c:\\cygwin64 You need: make, cmake, gcc, gettext-devel pkg-config, dos2unix, zlib-devel, libexpat1-devel, git, python3-interpreter, libiconv, libxml2-utils, libncurses. @@ -840,7 +817,7 @@ There is a discussion on the web about installing GTest: [https://github.com/Exi Download and build cmake from source because I can't get the cygwin installed cmake 3.6.2 to work. To build cmake from source, you need libncurses. [https://cmake.org/download/](https://cmake.org/download/) -I use the following batch file "cygwin64.bat" to start the Cygwin/64 bit bash shell from the Dos Command Prompt (cmd.exe). +I use the following batch file "cygwin64.bat" to start the Cygwin/64 bash shell from the Dos Command Prompt (cmd.exe). ```bat @echo off @@ -930,4 +907,4 @@ Work in progress: [https://github.com/Exiv2/exiv2/issues/902](https://github.co Robin Mills -Revised: 2019-08-03 +Revised: 2020-03-23 From 7a9a0757ab01ca5e51d68c66d8b965866298e061 Mon Sep 17 00:00:00 2001 From: clanmills Date: Wed, 25 Mar 2020 12:04:59 +0000 Subject: [PATCH 5/5] Pointless change to trigger CI to build (appveyor panick). --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 250a343c..6b7405c8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ | [![Build Status](https://travis-ci.org/Exiv2/exiv2.svg?branch=0.27-maintenance)](https://travis-ci.org/Exiv2/exiv2) | [![Build status](https://ci.appveyor.com/api/projects/status/d6vxf2n0cp3v88al/branch/0.27-maintenance?svg=true)](https://ci.appveyor.com/project/piponazo/exiv2-wutfp/branch/0.27-maintenance) | [![pipeline status](https://gitlab.com/D4N/exiv2/badges/0.27-maintenance/pipeline.svg)](https://gitlab.com/D4N/exiv2/commits/0.27-maintenance) | [![codecov](https://codecov.io/gh/Exiv2/exiv2/branch/0.27-maintenance/graph/badge.svg)](https://codecov.io/gh/Exiv2/exiv2) | [![Packaging status](https://repology.org/badge/tiny-repos/exiv2.svg)](https://repology.org/metapackage/exiv2/versions) |
-### TABLE OF CONTENTS +### TABLE OF CONTENTS 1. [Welcome to Exiv2](#1) 2. [Building, Installing, Using and Uninstalling Exiv2](#2)