diff --git a/.gitignore b/.gitignore index 3aca5e6440c..d54334f599a 100644 --- a/.gitignore +++ b/.gitignore @@ -167,6 +167,7 @@ php # ------------------------------------------------------------------------------ # Miscellaneous extensions files +/ext/fileinfo/libmagic.orig/ /ext/opcache/jit/zend_jit_x86.c /ext/opcache/jit/zend_jit_arm64.c /ext/opcache/minilua diff --git a/ext/fileinfo/generate_patch.sh b/ext/fileinfo/generate_patch.sh index abb6bf28d24..da99b1fcdb2 100755 --- a/ext/fileinfo/generate_patch.sh +++ b/ext/fileinfo/generate_patch.sh @@ -1,8 +1,16 @@ +#!/bin/sh + VERSION=5.45 -if [[ ! -d libmagic.orig ]]; then + +# Go to fileinfo extension directory. +cd $(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) + +if [ ! -d libmagic.orig ]; then mkdir libmagic.orig wget -O - ftp://ftp.astron.com/pub/file/file-$VERSION.tar.gz \ | tar -xz --strip-components=2 -C libmagic.orig file-$VERSION/src fi -sed -e "s/X\.YY/${VERSION//.}/g" libmagic.orig/magic.h.in > libmagic.orig/magic.h + +version_number=$(echo "$VERSION" | sed 's/\.//g') +sed -e "s/X\.YY/$version_number/g" libmagic.orig/magic.h.in > libmagic.orig/magic.h diff -u libmagic.orig libmagic | grep -v '^Only in' > libmagic.patch