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