xref: /PHP-8.4/ext/fileinfo/generate_patch.sh (revision 329890c1)
1#!/bin/sh
2
3VERSION=5.45
4
5# Go to fileinfo extension directory.
6cd "$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)" || exit
7
8if [ ! -d libmagic.orig ]; then
9  mkdir libmagic.orig
10  wget -O - ftp://ftp.astron.com/pub/file/file-$VERSION.tar.gz \
11    | tar -xz --strip-components=2 -C libmagic.orig file-$VERSION/src
12fi
13
14version_number=$(echo "$VERSION" | sed 's/\.//g')
15sed -e "s/X\.YY/$version_number/g" libmagic.orig/magic.h.in > libmagic.orig/magic.h
16diff -u libmagic.orig libmagic | grep -v '^Only in' > libmagic.patch
17