14 ARGS="${ARGS} LD=\"${LD}\""
19 ARGS="${ARGS} AS=\"${AS}\""
29 gen_die "compile_generic(): improper usage"
34 if [ "${DEBUGLEVEL}" -gt "1" ]
36 # Output to stdout and debugfile
37 print_info 2 "COMMAND: ${MAKE} ${ARGS} ${MAKEOPTS} ${1}" 1 0
38 ${MAKE} ${ARGS} ${MAKEOPTS} ${1} 2>&1 | tee -a ${DEBUGFILE}
41 # Output to debugfile only
42 print_info 2 "COMMAND: ${MAKE} ${ARGS} ${MAKEOPTS} ${1}" 1 0
43 ${MAKE} ${ARGS} ${MAKEOPTS} ${1} >> ${DEBUGFILE} 2>&1
46 [ "${RET}" -ne "0" ] && gen_die "compile of failed"
50 # Only make dep for 2.4 kernels
51 if [ "${PAT}" -gt "4" ]
53 print_info 1 "kernel: skipping make dep for non 2.4 kernels"
55 print_info 1 "kernel: Making dependancies for linux ${KV}"
62 print_info 1 "kernel: Starting compile of linux ${KV} modules"
64 compile_generic "modules"
65 compile_generic "modules_install"
69 [ "${KERNEL_MAKE}" = "" ] && gen_die "KERNEL_MAKE undefined. Don't know how to compile kernel for arch."
71 print_info 1 "kernel: Starting compile of linux ${KV} ${KERNEL_MAKE}"
72 compile_generic "${KERNEL_MAKE}"
73 cp "${KERNEL_BINARY}" "/boot/kernel-${KV}" || gen_die "Could not copy kernel binary to boot"
77 if [ ! -f "${BUSYBOX_BINCACHE}" ]
79 [ ! -f "${BUSYBOX_SRCTAR}" ] && gen_die "Could not find busybox source tarball: ${BUSYBOX_SRCTAR}"
80 [ ! -f "${BUSYBOX_CONFIG}" ] && gen_die "Cound not find busybox config file: ${BUSYBOX_CONFIG}"
82 rm -rf ${BUSYBOX_DIR} > /dev/null
83 tar -jxpf ${BUSYBOX_SRCTAR} || gen_die "Could not extract busybox source tarball"
84 [ ! -d "${BUSYBOX_DIR}" ] && gen_die "Busybox directory ${BUSYBOX_DIR} invalid"
85 cp "${BUSYBOX_CONFIG}" "${BUSYBOX_DIR}/.config"
87 if [ "${USE_DIETLIBC}" -eq "1" ]
90 CC="${TEMP}/diet/bin/diet ${CC}"
92 print_info 1 "Busybox: make oldconfig"
93 compile_generic "oldconfig"
94 print_info 1 "Busybox: make all"
96 if [ "${USE_DIETLIBC}" -eq "1" ]
100 print_info 1 "Busybox: copying to bincache"
101 [ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] && gen_die "busybox executable does not exist after compile, error"
102 strip "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "could not strip busybox"
103 bzip2 "${TEMP}/${BUSYBOX_DIR}/busybox" || gen_die "bzip2 compression of busybox failed"
104 [ ! -f "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" ] && gen_die "could not find compressed busybox binary"
105 mv "${TEMP}/${BUSYBOX_DIR}/busybox.bz2" "${BUSYBOX_BINCACHE}" || gen_die "could not copy busybox binary to arch package directory, does the directory exist?"
107 print_info 1 "Busybox: Found bincache at ${BUSYBOX_BINCACHE}"
112 if [ ! -f "${MODUTILS_BINCACHE}" ]
114 [ ! -f "${MODUTILS_SRCTAR}" ] && gen_die "Could not find modutils source tarball: ${MODUTILS_BINCACHE}"
116 rm -rf "${MODUTILS_DIR}"
117 tar -jxpf "${MODUTILS_SRCTAR}"
118 [ ! -d "${MODUTILS_DIR}" ] && gen_die "Modutils directory ${MODUTILS_DIR} invalid"
120 print_info 1 "modutils: configure"
121 ${ARGS} ./configure --disable-combined --enable-insmod-static >> ${DEBUGFILE} 2>&1 || gen_die "Configure of modutils failed"
122 print_info 1 "modutils: make all"
123 compile_generic "all"
124 print_info 1 "modutils: copying to bincache"
125 [ ! -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" ] && gen_die "insmod.static does not exist after compilation of modutils"
126 strip "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "could not strip insmod.static"
127 bzip2 "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static" || gen_die "compression of insmod.static failed"
128 [ ! -f "${TEMP}/${MODUTILS_DIR}/insmod/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary"
129 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODUTILS_BINCACHE}"
131 print_info 1 "modutils: Found bincache at ${MODUTILS_BINCACHE}"
135 compile_module_init_tools() {
136 if [ ! -f "${MODULE_INIT_TOOLS_BINCACHE}" ]
138 [ ! -f "${MODULE_INIT_TOOLS_SRCTAR}" ] && gen_die "Could not find module-init-tools source tarball: ${MODULE_INIT_TOOLS_BINCACHE}"
140 rm -rf "${MODULE_INIT_TOOLS_DIR}"
141 tar -jxpf "${MODULE_INIT_TOOLS_SRCTAR}"
142 [ ! -d "${MODULE_INIT_TOOLS_DIR}" ] && gen_die "Module-init-tools directory ${MODULE_INIT_TOOLS_DIR} invalid"
143 cd "${MODULE_INIT_TOOLS_DIR}"
144 print_info 1 "module-init-tools: configure"
145 ${ARGS} ./configure >> ${DEBUGFILE} 2>&1 || gen_die "Configure of module-init-tools failed"
146 print_info 1 "module-init-tools: make all"
147 compile_generic "all"
148 print_info 1 "module-init-tools: copying to bincache"
149 [ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" ] && gen_die "insmod.static does not exist after compilation of module-init-tools"
150 strip "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "could not strip insmod.static"
151 bzip2 "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static" || gen_die "compression of insmod.static failed"
152 [ ! -f "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" ] && gen_die "could not find compressed insmod.static.bz2 binary"
153 mv "${TEMP}/${MODULE_INIT_TOOLS_DIR}/insmod.static.bz2" "${MODULE_INIT_TOOLS_BINCACHE}"
155 print_info 1 "module-init-tools: Found bincache at ${MODULE_INIT_TOOLS_BINCACHE}"
164 [ ! -f "${DIETLIBC_BINCACHE}" ] && BUILD_DIETLIBC=1
165 [ ! -f "${DIETLIBC_BINCACHE_TEMP}" ] && BUILD_DIETLIBC=1
166 if [ "${BUILD_DIETLIBC}" -eq "0" ]
168 ORIGTEMP=`cat "${DIETLIBC_BINCACHE_TEMP}"`
169 if [ "${TEMP}" != "${ORIGTEMP}" ]
171 print_info 1 "Dietlibc: Bincache exists, but current temp directory is different than original. Rebuilding."
176 if [ "${BUILD_DIETLIBC}" -eq "1" ]
178 [ ! -f "${DIETLIBC_SRCTAR}" ] && gen_die "Could not find dietlibc source tarball: ${DIETLIBC_SRCTAR}"
180 rm -rf ${DIETLIBC_DIR} > /dev/null
181 tar -jxpf ${DIETLIBC_SRCTAR} || gen_die "Could not extract dietlibc source tarball"
182 [ ! -d "${DIETLIBC_DIR}" ] && gen_die "Dietlibc directory ${DIETLIBC_DIR} invalid"
184 print_info 1 "Dietlibc: make"
185 compile_generic "prefix=${TEMP}/diet"
186 print_info 1 "Dietlibc: installing"
187 compile_generic "prefix=${TEMP}/diet install"
188 print_info 1 "Dietlibc: copying to bincache"
190 tar -jcpf "${DIETLIBC_BINCACHE}" diet || gen_die "Could not tar up dietlibc bin"
191 [ ! -f "${DIETLIBC_BINCACHE}" ] && gen_die "bincache not created"
192 echo "${TEMP}" > "${DIETLIBC_BINCACHE_TEMP}"
194 print_info 1 "Dietlibc: Found bincache at ${DIETLIBC_BINCACHE}"