source: autobuild/scripts/unpackphpsource @ 905

Last change on this file since 905 was 905, checked in by moo, 22 months ago

import auto build scripts

  • Property svn:executable set to *
File size: 1.9 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)
20
21sourceFiles=(configure.in main/internal_functions.c.in)
22if [[ $phpVersionMajor -ge 5 ]]; then
23    pushv sourceFile "win32/build"
24fi
25
26headerDirs=(main TSRM Zend win32 ext/standard)
27if [[ $phpVersionMajor -gt 5 ]] || [[ $phpVersionMajor -eq 5 && $phpVersionMinor -gt 0 ]]; then
28    pushv headerDir ext/date
29fi
30if [[ $phpVersionMajor -lt 5 ]] || [[ $phpVersionMajor -eq 5 && $phpVersionMinor -lt 2 ]] || [[ $phpVersionMajor -eq 6 ]]; then
31    pushv sourceFile README.CVS-RULES
32else
33    pushv sourceFile README.SVN-RULES
34fi
35if [[ $phpVersionMajor -lt 5 ]] || [[ $phpVersionMajor -eq 5 && $phpVersionMinor -lt 3 ]]; then
36    pushv headerDir regex
37fi
38for headerDir in "${headerDirs[@]}"; do
39    pushv sourceFile "$headerDir/*.h"
40done
41
42case "$phpVersion" in
43*-dev-*)
44    prefix="php${phpVersion/.0-dev-/-}"
45    prefix="${prefix%-*}-*"
46    ;;
47*)
48    prefix="php-$phpVersion"
49    ;;
50esac
51sourcePaths=()
52for sourceFile in "${sourceFiles[@]}"; do
53    pushv sourcePath "$prefix/$sourceFile"
54done
55echo "Unpacking ${sourceFiles[@]} ..."; {
56    rm -rf "$unpackDir.tmp" || die
57    mkdir "$unpackDir.tmp" || die
58    cd "$unpackDir.tmp" || die
59    tar --wildcards -jxvf "$phpSourcePackage" "${sourcePaths[@]}" || die "failed unpacking"
60    mv "$unpackDir.tmp/"$prefix/* "$unpackDir/"
61    cd ..
62    rm -rf "$unpackDir.tmp"
63}
64
65if [[ $phpVersionMajor -ge 5 ]] && [[ ! -d $develDir/win32build/build ]]; then
66    mkdir -p "$develDir/win32build"
67    cp -v -uaR "$unpackDir"/win32/build $develDir/win32build/build
68fi
Note: See TracBrowser for help on using the repository browser.