source: autobuild/scripts/unpackphpsource

Last change on this file was 948, checked in by moo, 2 years ago

fix for php git repo

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2. scripts/common
3
4[[ $# != 3 ]] && die "Usage: $0 <phpVersion> <phpSourcePackage> <directory>"
5phpVersion="$1"
6phpSourcePackage="$2"
7[[ -s $phpSourcePackage ]] || die "$phpSourcePackage not found as a file"
8unpackDir="$3"
9[[ -d $unpackDir ]] || die "$unpackDir not found as a directory"
10
11
12begin "Cleaning $unpackDir"; {
13    rm -rf "$unpackDir"
14    rm -rf "$unpackDir.tmp"
15    mkdir "$unpackDir/"
16}; end
17
18phpVersionMajor=$(getVersionPart 0 $phpVersion)
19phpVersionMinor=$(getVersionPart 1 $phpVersion)
20phpVersionPatch=$(getVersionPart 2 $phpVersion)
21
22sourceFiles=(configure.in main/internal_functions.c.in)
23if [[ $phpVersionMajor -ge 5 ]]; then
24    pushv sourceFile "win32/build"
25fi
26
27headerDirs=(main TSRM Zend win32 ext/standard)
28if [[ $phpVersionMajor -gt 5 ]] || [[ $phpVersionMajor -eq 5 && $phpVersionMinor -gt 0 ]]; then
29    pushv headerDir ext/date
30fi
31if [[ $phpVersionMajor -lt 5 ]] || [[ $phpVersionMajor -eq 5 && $phpVersionMinor -lt 2 ]] || [[ $phpVersionMajor -eq 6 ]]; then
32    pushv sourceFile README.CVS-RULES
33elif [[ $phpVersionMajor -eq 5 && $phpVersionMinor -eq 2 ]] \
34 || [[ $phpVersionMajor -eq 5 && $phpVersionMinor -eq 3 && $phpVersionPatch -lt 14 ]] \
35 || [[ $phpVersionMajor -eq 5 && $phpVersionMinor -eq 4 && $phpVersionPatch -lt 4 ]]; then
36    pushv sourceFile README.SVN-RULES
37else
38    pushv sourceFile README.GIT-RULES
39fi
40if [[ $phpVersionMajor -lt 5 ]] || [[ $phpVersionMajor -eq 5 && $phpVersionMinor -lt 3 ]]; then
41    pushv headerDir regex
42fi
43for headerDir in "${headerDirs[@]}"; do
44    pushv sourceFile "$headerDir/*.h"
45done
46
47case "$phpVersion" in
48*-dev-*)
49    prefix="php${phpVersion/.0-dev-/-}"
50    prefix="${prefix%-*}-*"
51    ;;
52*)
53    prefix="php-$phpVersion"
54    ;;
55esac
56sourcePaths=()
57for sourceFile in "${sourceFiles[@]}"; do
58    pushv sourcePath "$prefix/$sourceFile"
59done
60echo "Unpacking ${sourceFiles[@]} ..."; {
61    rm -rf "$unpackDir.tmp" || die
62    mkdir "$unpackDir.tmp" || die
63    cd "$unpackDir.tmp" || die
64    tar --wildcards -jxvf "$phpSourcePackage" "${sourcePaths[@]}" || die "failed unpacking"
65    mv "$unpackDir.tmp/"$prefix/* "$unpackDir/"
66    cd ..
67    rm -rf "$unpackDir.tmp"
68}
69
70if [[ $phpVersionMajor -ge 5 ]] && [[ ! -d $develDir/win32build/build ]]; then
71    mkdir -p "$develDir/win32build"
72    cp -v -uaR "$unpackDir"/win32/build $develDir/win32build/build
73fi
Note: See TracBrowser for help on using the repository browser.