/[gentoo]/src/patchsets/gcc/make-tarball.sh
Gentoo

Contents of /src/patchsets/gcc/make-tarball.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (show annotations) (download) (as text)
Sat Jan 6 19:38:11 2018 UTC (7 months, 1 week ago) by slyfox
Branch: MAIN
CVS Tags: HEAD
Changes since 1.15: +1 -0 lines
File MIME type: text/x-sh
make-tarball.sh: tweak patch generation for PORTDIR!=/usr/portage

1 #!/bin/bash
2
3 if [[ $# -ne 1 ]] ; then
4 echo "Usage: $0 <gcc ebuild>"
5 exit 1
6 fi
7
8 ver=${1%/}
9 for ebuild in \
10 ${ver} \
11 /usr/local/src/gentoo/repo/gentoo/sys-devel/gcc/gcc-${ver}.ebuild \
12 "$(portageq get_repo_path / gentoo)"/sys-devel/gcc/gcc-${ver}.ebuild \
13 /usr/portage/sys-devel/gcc/gcc-${ver}.ebuild \
14 ""
15 do
16 [[ -f ${ebuild} ]] && break
17 done
18 if [[ -z ${ebuild} ]] ; then
19 echo "!!! gcc ebuild '${ver}' does not exist"
20 exit 1
21 fi
22
23 digest=${ebuild/.ebuild}
24 rm -f ${digest/gcc\//gcc\/files\/digest-}
25 gver=${ebuild##*/gcc/gcc-} # trim leading path
26 gver=${gver%%.ebuild} # trim post .ebuild
27 gver=${gver%%-*} # trim any -r#'s
28
29 # trim branch update number
30 sgver=$(echo ${gver} | sed -e 's:[0-9]::g')
31 [[ ${#sgver} -gt 2 ]] \
32 && sgver=${gver%.*} \
33 || sgver=${gver}
34
35 eread() {
36 inherit(){ :;}
37 while [[ $# -gt 0 ]] ; do
38 export $1=$(source ${ebuild} 2>/dev/null; echo ${!1})
39 shift
40 done
41 }
42 eread UCLIBC_VER PP_VER HTB_VER HTB_GCC_VER MAN_VER SPECS_VER SPECS_GCC_VER
43 [[ -n ${HTB_VER} && -z ${HTB_GCC_VER} ]] && HTB_GCC_VER=${gver}
44 PATCH_VER=$(awk '{print $1; exit}' ./${gver}/gentoo/README.history)
45 PIE_VER=$(awk '{print $1; exit}' ./${gver}/pie/README.history)
46
47 if [[ ! -d ./${gver} ]] ; then
48 echo "Error: ${gver} is not a valid gcc ver"
49 exit 1
50 fi
51
52 echo "Building patches for gcc version ${gver}"
53 echo " - PATCH: ${PATCH_VER} (taken from ${gver}/gentoo/README.history)"
54 echo " - UCLIBC: ${UCLIBC_VER}"
55 echo " - PIE: ${PIE_VER} (taken from ${gver}/pie/README.history)"
56 echo " - SPECS: ${SPECS_VER} (${SPECS_GCC_VER:-${gver}})"
57 echo " - SSP: ${PP_VER}"
58 echo " - BOUNDS: ${HTB_GCC_VER}-${HTB_VER}"
59 echo " - MAN: ${MAN_VER}"
60
61 rm -rf tmp
62 rm -f gcc-${gver}-*.tar.bz2
63
64 # standard jobbies
65 mkdir -p tmp/patch/exclude tmp/uclibc tmp/piepatch tmp/specs
66 [[ -n ${PATCH_VER} ]] && cp ${gver}/gentoo/*.patch ../README* tmp/patch/
67 [[ -d ${gver}/man ]] && cp -r ${gver}/man tmp/
68 [[ -n ${UCLIBC_VER} ]] && cp -r ${gver}/uclibc/* ../README* tmp/uclibc/
69 [[ -n ${PIE_VER} ]] && cp -r ${gver}/pie/* ../README* tmp/piepatch/
70 [[ -n ${PP_VER} ]] && cp -r ${gver}/ssp tmp/
71 [[ -n ${SPECS_VER} ]] && cp -r ${SPECS_GCC_VER:-${gver}}/specs/* tmp/specs/
72 # extra cruft
73 [[ -n ${HTB_VER} ]] && \
74 cp ${gver}/misc/bounds-checking-gcc*.patch \
75 tmp/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch
76 find tmp/ -name CVS -type d | xargs rm -rf
77
78 # standard jobbies
79 [[ -n ${PATCH_VER} ]] && {
80 tar -jcf gcc-${sgver}-patches-${PATCH_VER}.tar.bz2 \
81 -C tmp patch || exit 1 ; }
82 [[ -n ${UCLIBC_VER} ]] && {
83 tar -jcf gcc-${sgver}-uclibc-patches-${UCLIBC_VER}.tar.bz2 \
84 -C tmp uclibc || exit 1 ; }
85 [[ -n ${PIE_VER} ]] && {
86 tar -jcf gcc-${sgver}-piepatches-v${PIE_VER}.tar.bz2 \
87 -C tmp piepatch || exit 1 ; }
88 [[ -n ${SPECS_VER} ]] && {
89 tar -jcf gcc-${sgver}-specs-${SPECS_VER}.tar.bz2 \
90 -C tmp specs || exit 1 ; }
91 [[ -n ${PP_VER} ]] && {
92 mv tmp/ssp/protector.patch tmp/ssp/gcc-${gver}-ssp.patch
93 tar -jcf gcc-${gver}-ssp-${PP_VER}.tar.bz2 \
94 -C tmp ssp || exit 1 ; }
95 [[ -d ${gver}/man ]] && {
96 tar -jcf gcc-${MAN_VER}-manpages.tar.bz2 \
97 -C tmp/man . || exit 1 ; }
98 # extra cruft
99 [[ -n ${HTB_VER} ]] && {
100 bzip2 tmp/bounds-checking-*.patch \
101 && cp tmp/bounds-checking-*.patch.bz2 . || exit 1 ; }
102 rm -rf tmp
103
104 du -b *.bz2

  ViewVC Help
Powered by ViewVC 1.1.20