Skip to content

Commit 31a21bb

Browse files
authored
Make ext/fileinfo/generate_patch.sh simpler to use (#14941)
- Shebang added so it can be called with ./generate_patch.sh - Script changes its working directory to ext/fileinfo (where it is located) so it can be also called as ./ext/fileinfo/generate_patch.sh - Syntax adjusted a bit for using Bourne or a compatible shell (/bin/sh) - Downloaded files added to .gitignore
1 parent 79c134a commit 31a21bb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ php
167167
# ------------------------------------------------------------------------------
168168

169169
# Miscellaneous extensions files
170+
/ext/fileinfo/libmagic.orig/
170171
/ext/opcache/jit/zend_jit_x86.c
171172
/ext/opcache/jit/zend_jit_arm64.c
172173
/ext/opcache/minilua

ext/fileinfo/generate_patch.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
#!/bin/sh
2+
13
VERSION=5.45
2-
if [[ ! -d libmagic.orig ]]; then
4+
5+
# Go to fileinfo extension directory.
6+
cd $(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
7+
8+
if [ ! -d libmagic.orig ]; then
39
mkdir libmagic.orig
410
wget -O - ftp://ftp.astron.com/pub/file/file-$VERSION.tar.gz \
511
| tar -xz --strip-components=2 -C libmagic.orig file-$VERSION/src
612
fi
7-
sed -e "s/X\.YY/${VERSION//.}/g" libmagic.orig/magic.h.in > libmagic.orig/magic.h
13+
14+
version_number=$(echo "$VERSION" | sed 's/\.//g')
15+
sed -e "s/X\.YY/$version_number/g" libmagic.orig/magic.h.in > libmagic.orig/magic.h
816
diff -u libmagic.orig libmagic | grep -v '^Only in' > libmagic.patch

0 commit comments

Comments
 (0)