Annotation of /smage/branches/alx-0_7/include/alx.sminc
Parent Directory | Revision Log
Revision 4439 -
(hide annotations)
(download)
Thu Nov 22 15:03:44 2012 UTC (11 years, 10 months ago) by niro
File size: 3316 byte(s)
Thu Nov 22 15:03:44 2012 UTC (11 years, 10 months ago) by niro
File size: 3316 byte(s)
-moved files to the right place
1 | niro | 1667 | # $Id$ |
2 | # alx specific functions | ||
3 | niro | 1661 | |
4 | niro | 1667 | # some global includes |
5 | sminclude cleanutils mtools | ||
6 | niro | 1661 | |
7 | niro | 2066 | # include alx functions |
8 | niro | 2076 | INHERITS="${INHERITS} alx" |
9 | niro | 2066 | |
10 | niro | 1667 | # injects files to given path (defaults to /usr/bin) |
11 | # mcinjectfile file {/path/to/dest} | ||
12 | mcinjectfile() | ||
13 | niro | 1661 | { |
14 | niro | 1667 | local file |
15 | local dest | ||
16 | niro | 1661 | |
17 | niro | 1667 | [[ -z $1 ]] && die "No etc file given" |
18 | |||
19 | file="${SMAGENAME%/*}/alx/files/$1" | ||
20 | dest="$2" | ||
21 | if [[ -z $2 ]] | ||
22 | niro | 1661 | then |
23 | niro | 1667 | dest=/usr/bin |
24 | install -d ${BINDIR}/${dest} || die | ||
25 | fi | ||
26 | niro | 1661 | |
27 | niro | 1667 | # install our configfile |
28 | install -m 0644 -o root -g root ${file} ${BINDIR}/${dest} || die | ||
29 | } | ||
30 | niro | 1661 | |
31 | niro | 1667 | # injects executables to given path |
32 | # mcinjectexec exec {/path/to/dest} | ||
33 | mcinjectexec() | ||
34 | { | ||
35 | local file | ||
36 | local dest | ||
37 | |||
38 | [[ -z $1 ]] && die "No etc file given" | ||
39 | |||
40 | file="${SMAGENAME%/*}/alx/files/$1" | ||
41 | dest="$2" | ||
42 | if [[ -z $2 ]] | ||
43 | then | ||
44 | dest=/usr/bin | ||
45 | install -d ${BINDIR}/${dest} || die | ||
46 | niro | 1661 | fi |
47 | |||
48 | niro | 1667 | # install our configfile |
49 | install -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die | ||
50 | niro | 1661 | } |
51 | |||
52 | niro | 1667 | # injects a patch to the sourcecode |
53 | # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files | ||
54 | # mcinjectpatch patch | ||
55 | mcinjectpatch() | ||
56 | niro | 1661 | { |
57 | niro | 1667 | local PATCHOPTS |
58 | local PATCHFILE | ||
59 | local i | ||
60 | |||
61 | PATCHOPTS=$1 | ||
62 | PATCHFILE=$2 | ||
63 | |||
64 | if [[ -z $2 ]] | ||
65 | niro | 1661 | then |
66 | niro | 1667 | PATCHFILE=$1 |
67 | |||
68 | ## patch level auto-detection, get patch level | ||
69 | for ((i=0; i < 10; i++)) | ||
70 | niro | 1661 | do |
71 | niro | 1667 | patch --dry-run -Np${i} -i ${SMAGENAME%/*}/alx/files/${PATCHFILE} > /dev/null |
72 | if [[ $? = 0 ]] | ||
73 | then | ||
74 | PATCHOPTS="-Np${i}" | ||
75 | break | ||
76 | fi | ||
77 | niro | 1661 | done |
78 | fi | ||
79 | |||
80 | niro | 1667 | echo -e "${COLBLUE}*** ${COLGREEN}Applying ALX patch '${PATCHFILE}'${COLDEFAULT}" |
81 | patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/alx/files/${PATCHFILE} | ||
82 | niro | 1661 | } |
83 | |||
84 | niro | 1667 | ############################# |
85 | ##### compile functions #### | ||
86 | ############################# | ||
87 | |||
88 | # respect multilib! | ||
89 | if [[ -z $(typeset -f oldconfigure) ]] | ||
90 | then | ||
91 | alx_old_mconfigure=alx_old$(typeset -f mconfigure) | ||
92 | else | ||
93 | alx_old_mconfigure=alx_old$(typeset -f oldmconfigure) | ||
94 | fi | ||
95 | eval ${alx_old_mconfigure} | ||
96 | mconfigure() | ||
97 | niro | 1661 | { |
98 | niro | 1667 | local myconf |
99 | local configurefile | ||
100 | |||
101 | # get configure instructions from smage dir | ||
102 | if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg ]] | ||
103 | niro | 1661 | then |
104 | niro | 1667 | # version specific configure files |
105 | configurefile=${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg | ||
106 | elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.cfg ]] | ||
107 | then | ||
108 | # generic configure files for a package | ||
109 | configurefile=${SMAGENAME%/*}/alx/${PNAME}.cfg | ||
110 | else | ||
111 | configurefile="" | ||
112 | fi | ||
113 | |||
114 | # now read the content | ||
115 | if [[ -f ${configurefile} ]] | ||
116 | then | ||
117 | echo -e "${COLBLUE}*** ${COLGREEN}Using configure info from ${configurefile}${COLDEFAULT}" | ||
118 | local line | ||
119 | while read line | ||
120 | niro | 1661 | do |
121 | niro | 1667 | # ignore empty and commeted lines |
122 | case "${line}" in | ||
123 | \#*|"") continue ;; | ||
124 | esac | ||
125 | |||
126 | echo -e " adding ${COLGREEN}${line}${COLDEFAULT} to ALX_CONFIGURE_OPTS" | ||
127 | ALX_CONFIGURE_OPTS+=" ${line}" | ||
128 | done < ${configurefile} | ||
129 | niro | 1661 | fi |
130 | |||
131 | niro | 3884 | alx_oldmconfigure ${myconf} $@ ${ALX_CONFIGURE_OPTS} || die |
132 | niro | 1661 | } |
133 | niro | 1667 | |
134 | # get custom mcore functions | ||
135 | if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom ]] | ||
136 | then | ||
137 | echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom${COLDEFAULT}" | ||
138 | source ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom | ||
139 | elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.custom ]] | ||
140 | then | ||
141 | echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}.custom${COLDEFAULT}" | ||
142 | source ${SMAGENAME%/*}/alx/${PNAME}.custom | ||
143 | fi |