file: Bump file and libmagic to latest version 5.38

Add new dependencies on bzip2, xz and zlib.
Add check step to run upstream tests.
Add prepare step and advanced patch to fix broken Windows build bug
tracked upstream at: https://bugs.astron.com/view.php?id=163

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
This commit is contained in:
Philippe Ombredanne
2020-05-18 13:08:41 +02:00
parent 0f75a3699e
commit 3a51faadb8
2 changed files with 46 additions and 5 deletions

View File

@@ -0,0 +1,25 @@
# this is an advanced patch to fix building v5.38
# see for details
# this patch should be removed with the next version
diff --git a/src/compress.c b/src/compress.c
index 33ce2bc..f172eda 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -378,7 +378,7 @@
sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__)))
{
ssize_t rv;
-#ifdef FIONREAD
+#if defined(FIONREAD) && !defined(__MINGW32__) && !defined(WIN32)
int t = 0;
#endif
size_t rn = n;
@@ -386,7 +386,7 @@
if (fd == STDIN_FILENO)
goto nocheck;
-#ifdef FIONREAD
+#if defined(FIONREAD) && !defined(__MINGW32__) && !defined(WIN32)
if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
#ifdef FD_ZERO
ssize_t cnt;

View File

@@ -3,17 +3,27 @@
_realname=file
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=5.37
pkgver=5.38
pkgrel=1
pkgdesc='Determine the type of a file from its contents (mingw-w64)'
arch=('any')
url='https://www.darwinsys.com/file/'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-libsystre")
source=(ftp://ftp.astron.com/pub/file/${_realname}-${pkgver}.tar.gz)
sha256sums=('e9c13967f7dd339a3c241b7710ba093560b9a33013491318e88e6b8b57bae07f')
depends=(${MINGW_PACKAGE_PREFIX}-bzip2
${MINGW_PACKAGE_PREFIX}-libsystre
${MINGW_PACKAGE_PREFIX}-xz
${MINGW_PACKAGE_PREFIX}-zlib)
source=("ftp://ftp.astron.com/pub/file/${_realname}-${pkgver}.tar.gz"
"0001-file-5.38-mingw-build.patch")
sha256sums=('593c2ffc2ab349c5aea0f55fedfe4d681737b6b62376a9b3ad1e77b2cc19fa34'
'65e8ec923de7fed74ed3bf204a562e38a8b077b24dc3d1cce09578deba2b3667')
options=('strip' '!libtool' 'staticlibs')
prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
patch -p1 -i ${srcdir}/0001-file-5.38-mingw-build.patch
}
build() {
[[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
@@ -23,11 +33,17 @@ build() {
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--enable-shared \
--enable-static
--enable-static \
--disable-libseccomp
make
}
check() {
cd ${srcdir}/build-${CARCH}
make -C tests check
}
package() {
cd "${srcdir}/build-${CARCH}"
make install DESTDIR="${pkgdir}"