Exiv2 / exiv2

Image metadata library and tools
http://www.exiv2.org/
Other
932 stars 281 forks source link

Support build/test of Exiv2 on NetBSD #823

Closed clanmills closed 5 years ago

clanmills commented 5 years ago

This is derived from a discussion about #818

clanmills commented 5 years ago

Here's the patch:

localhost$ git status
On branch 0.27-maintenance
Your branch is up to date with 'origin/0.27-maintenance'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   ../cmake/config.h.cmake
        modified:   ../test/functions.source

no changes added to commit (use "git add" and/or "git commit -a")
localhost$ git diff
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index b3290633..b5652cc8 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -35,7 +35,7 @@

 /* Define to `const' or to empty, depending on the second argument of `iconv'. */
 #cmakedefine ICONV_ACCEPTS_CONST_INPUT
-#if defined ICONV_ACCEPTS_CONST_INPUT
+#if defined(ICONV_ACCEPTS_CONST_INPUT) || defined(__NetBSD__)
 #define EXV_ICONV_CONST const
 #else
 #define EXV_ICONV_CONST
diff --git a/test/functions.source b/test/functions.source
index a8cfe22b..0c5d2189 100644
--- a/test/functions.source
+++ b/test/functions.source
@@ -421,7 +421,11 @@ checkSum()
 {
     # cygwin checksum: http://esrg.sourceforge.net/utils_win_up/md5sum/
     # macosx - built/installed coreutils 8.25 http://ftp.gnu.org/gnu/coreutils/
-    md5sum $1 | cut -d' ' -f 1
+    if [ $(uname) == 'NetBSD' ]; then
+      md5 -q $1
+    else
+      md5sum $1 | cut -d' ' -f 1
+    fi
 }

 ##
localhost$ 
localhost$ 
localhost$ uname -a
NetBSD localhost 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
localhost$ git status
On branch 0.27-maintenance
Your branch is up to date with 'origin/0.27-maintenance'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   ../cmake/config.h.cmake
        modified:   ../test/functions.source

no changes added to commit (use "git add" and/or "git commit -a")
localhost$ git diff
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index b3290633..b5652cc8 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -35,7 +35,7 @@

 /* Define to `const' or to empty, depending on the second argument of `iconv'. */
 #cmakedefine ICONV_ACCEPTS_CONST_INPUT
-#if defined ICONV_ACCEPTS_CONST_INPUT
+#if defined(ICONV_ACCEPTS_CONST_INPUT) || defined(__NetBSD__)
 #define EXV_ICONV_CONST const
 #else
 #define EXV_ICONV_CONST
diff --git a/test/functions.source b/test/functions.source
index a8cfe22b..0c5d2189 100644
--- a/test/functions.source
+++ b/test/functions.source
@@ -421,7 +421,11 @@ checkSum()
 {
     # cygwin checksum: http://esrg.sourceforge.net/utils_win_up/md5sum/
     # macosx - built/installed coreutils 8.25 http://ftp.gnu.org/gnu/coreutils/
-    md5sum $1 | cut -d' ' -f 1
+    if [ $(uname) == 'NetBSD' ]; then
+      md5 -q $1
+    else
+      md5sum $1 | cut -d' ' -f 1
+    fi
 }

 ##
localhost$ 

I'll submit this as a PR to 0.27-maintenance this evening.

clanmills commented 5 years ago

Unittests

build/install google test to run the unit tests:

$ su root
# cd /usr/pkgsrc/devel/googletest
# make install
# exit

Build unit tests:

$ cd <exiv2dir>/build
$ cmake .. -DEXIV2_BUILD_UNIT_TESTS=On
$ make
$ bin/unit_tests
.....
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] strError.returnSuccessAfterClosingFile
[  FAILED  ] strError.doNotRecognizeUnknownError
[  FAILED  ] getProcessPath.obtainPathOfUnitTestsExecutable

Something wrong in obtaining the executable path. I'll investigate later.

D4N commented 5 years ago

Thanks for taking a look at this @clanmills. It would be nice to have a CI for this, but unfortunately there's literally no one offering NetBSD (FreeBSD is offered on sourcehut, which I plan on adding at some point).

clanmills commented 5 years ago

No problem. We can use Jenkins on the MacMini. @nehaljwani and I will work on that, right Nehal?

clanmills commented 5 years ago

Progress update.

The patch above is "basically valid". However there are several consequential issues to be considered. For example: 1) Make NetBSD a "supported build" and generate build bundles for release.

There's probably something I have not yet discovered (or forgotten, or overlooked).

I hope to complete the work in the next few days and submit a PR.

piponazo commented 5 years ago

@clanmills can we close this ticket once #833 was merged ?

clanmills commented 5 years ago

Yes. It's closed. I've update the Jenkins scripts (in SVN) to build on those platforms.