diff --git a/mingw-w64-gphoto2/01_gphoto_close_before_rename.patch b/mingw-w64-gphoto2/01_gphoto_close_before_rename.patch new file mode 100644 index 0000000000..7e41abe1fa --- /dev/null +++ b/mingw-w64-gphoto2/01_gphoto_close_before_rename.patch @@ -0,0 +1,59 @@ +commit ca4768323365cf347c7c7be59dbb04c51ae0a6a1 +Author: peterbud +Date: Mon Aug 28 14:10:49 2017 +0200 + + Close temp files before rename + +diff --git a/gphoto2/actions.c b/gphoto2/actions.c +index f34088e..8c8b51f 100644 +--- a/gphoto2/actions.c ++++ b/gphoto2/actions.c +@@ -978,6 +978,9 @@ _action_camera_capture_preview (GPParams *p, int viewasciiart) + return (r); + } + ++ //close the temp file as you cannot rename it later ++ if (fd) close (fd); ++ + /* name it file_%filename if --filename is set, otherwise capture_preview */ + r = save_camera_file_to_file (NULL, "capture_preview", p->filename?GP_FILE_TYPE_PREVIEW:GP_FILE_TYPE_NORMAL, file, tmpfilename); + gp_file_unref (file); +@@ -1016,7 +1019,7 @@ action_camera_capture_movie (GPParams *p, const char *arg) + fd = dup(fileno(stdout)); + xname = "stdout"; + } else { +- fd = open("movie.mjpg",O_WRONLY|O_CREAT,0660); ++ fd = open("movie.mjpg",O_WRONLY | O_CREAT | O_BINARY,0660); + if (fd == -1) { + cli_error_print(_("Could not open 'movie.mjpg'.")); + return GP_ERROR; +@@ -1070,6 +1073,9 @@ action_camera_capture_movie (GPParams *p, const char *arg) + } + gp_file_unref (file); + ++ //close the temp file as you cannot rename it later ++ if (fd) close (fd); ++ + fprintf(stderr,_("Movie capture finished (%d frames)\n"), captured_frames); + return GP_OK; + } +diff --git a/gphoto2/main.c b/gphoto2/main.c +index 01a045e..383ac28 100644 +--- a/gphoto2/main.c ++++ b/gphoto2/main.c +@@ -688,9 +688,14 @@ save_file_to_file (Camera *camera, GPContext *context, Flags flags, + unlink (tmpname); + return (GP_OK); + } +- res = save_camera_file_to_file (folder, filename, type, file, tmpfilename); ++ ++ //close the temp file as you cannot rename it later + if (ps && ps->fd) close (ps->fd); + free (ps); ++ ps = NULL; ++ if (fd) close (fd); ++ ++ res = save_camera_file_to_file (folder, filename, type, file, tmpfilename); + gp_file_unref (file); + if ((res!=GP_OK) && tmpfilename) + unlink (tmpfilename); diff --git a/mingw-w64-gphoto2/PKGBUILD b/mingw-w64-gphoto2/PKGBUILD new file mode 100644 index 0000000000..9ef8a91cf2 --- /dev/null +++ b/mingw-w64-gphoto2/PKGBUILD @@ -0,0 +1,44 @@ +# Maintainer: Peter Budai + +_realname=gphoto2 +pkgbase=mingw-w64-${_realname} +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") +pkgver=2.5.14 +pkgrel=1 +pkgdesc="The gphoto2 commandline tool for accessing and controlling digital cameras. (mingw-w64)" +arch=('any') +url='http://www.gphoto.org/' +license=('GNU') +depends=("${MINGW_PACKAGE_PREFIX}-libgphoto2" + "${MINGW_PACKAGE_PREFIX}-popt") +makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" + "${MINGW_PACKAGE_PREFIX}-libtool") +validpgpkeys=('7C4AFD61D8AAE7570796A5172209D6902F969C95') # Marcus Meissner +source=("https://sourceforge.net/projects/gphoto/files/gphoto/2.5.14/${_realname}-${pkgver}.tar.gz" + "01_gphoto_close_before_rename.patch") +sha256sums=('b85dcdf127b201a705f8c766e172b85191894cdc6b993a3821df3f40f7d01bed' + 'ca4e431c4f2bca1272a6580ebab7d81a82fa38fad07624cc8c6328b458293b19') + +prepare() { + cd $srcdir/${_realname}-${pkgver} + patch -p1 -i ${srcdir}/01_gphoto_close_before_rename.patch +} + +build() { + cd "$srcdir"/${_realname}-${pkgver} + [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH} + mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH} + ../${_realname}-${pkgver}/configure \ + --prefix=${MINGW_PREFIX} \ + --build=${MINGW_CHOST} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} + + make +} + + +package() { + cd "${srcdir}"/build-${CARCH} + make install DESTDIR="${pkgdir}" +}