+
+compile_iscsi() {
+ if [ ! -f "${ISCSI_BINCACHE}" ]
+ then
+ [ ! -f "${ISCSI_SRCTAR}" ] &&
+ gen_die "Could not find iSCSI source tarball: ${ISCSI_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${ISCSI_DIR}"
+ tar -zxpf "${ISCSI_SRCTAR}"
+ [ ! -d "${ISCSI_DIR}" ] &&
+ gen_die "ISCSI directory ${ISCSI_DIR} invalid"
+ print_info 1 'iSCSI: >> Compiling...'
+ cd "${TEMP}/${ISCSI_DIR}"
+ apply_patches iscsi ${ISCSI_VER}
+
+ # Only build userspace
+ print_info 1 'iSCSI: >> Configuring userspace...'
+ cd utils/open-isns || gen_die 'Could not enter open-isns dir'
+ # we currently have a patch that changes configure.ac
+ # once given patch is dropped, drop autoconf too
+ autoconf || gen_die 'Could not tweak open-iscsi configuration'
+ ./configure --without-slp >> ${LOGFILE} 2>&1 || gen_die 'Could not configure userspace'
+ cd ../.. || gen_die 'wtf?'
+ MAKE=${UTILS_MAKE} compile_generic "user" ""
+
+ # if kernel modules exist, copy them to initramfs, otherwise it will be compiled into the kernel
+ mkdir -p "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
+ for modname in iscsi_tcp libiscsi scsi_transport_iscsi
+ do
+ if [ -e "${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko" ]
+ then
+ cp ${CMD_KERNEL_DIR}/drivers/scsi/${modname}.ko "${TEMP}/initramfs-iscsi-temp/lib/modules/${RELEASE}/kernel/drivers/scsi/"
+ fi
+ done
+
+ cd "${TEMP}/initramfs-iscsi-temp/"
+ print_info 1 'iscsistart: >> Copying to cache...'
+ [ -f "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ] ||
+ gen_die 'iscsistart executable does not exist!'
+ ${UTILS_CROSS_COMPILE}strip "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
+ gen_die 'Could not strip iscsistart binary!'
+ bzip2 "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ||
+ gen_die 'bzip2 compression of iscsistart failed!'
+ mv "${TEMP}/${ISCSI_DIR}/usr/iscsistart.bz2" "${ISCSI_BINCACHE}" ||
+ gen_die 'Could not copy the iscsistart binary to the package directory, does the directory exist?'
+
+ cd "${TEMP}"
+ rm -rf "${ISCSI_DIR}" > /dev/null
+ fi
+}
+
+compile_gpg() {
+ if [ -f "${GPG_BINCACHE}" ]
+ then
+ print_info 1 "gnupg: >> Using cache"
+ else
+ [ ! -f "${GPG_SRCTAR}" ] &&
+ gen_die "Could not find gnupg source tarball: ${GPG_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf "${GPG_DIR}"
+ tar -jxf "${GPG_SRCTAR}"
+ [ ! -d "${GPG_DIR}" ] &&
+ gen_die "gnupg directory ${GPG_DIR} invalid"
+ cd "${GPG_DIR}"
+ apply_patches gnupg ${GPG_VER}
+ print_info 1 'gnupg: >> Configuring...'
+ # --enable-minimal works, but it doesn't reduce the command length much.
+ # Given its history and the precision this needs, explicit is cleaner.
+ LDFLAGS='-static' CFLAGS='-Os' ./configure --prefix=/ \
+ --enable-static-rnd=linux --disable-dev-random --disable-asm \
+ --disable-selinux-support --disable-gnupg-iconv --disable-card-support \
+ --disable-agent-support --disable-bzip2 --disable-exec \
+ --disable-photo-viewers --disable-keyserver-helpers --disable-ldap \
+ --disable-hkp --disable-finger --disable-generic --disable-mailto \
+ --disable-keyserver-path --disable-dns-srv --disable-dns-pka \
+ --disable-dns-cert --disable-nls --disable-threads --disable-regex \
+ --disable-optimization --with-included-zlib --without-capabilities \
+ --without-tar --without-ldap --without-libcurl --without-mailprog \
+ --without-libpth-prefix --without-libiconv-prefix --without-libintl-prefix\
+ --without-zlib --without-bzip2 --without-libusb --without-readline \
+ >> ${LOGFILE} 2>&1 || gen_die 'Configuring gnupg failed!'
+ print_info 1 'gnupg: >> Compiling...'
+ compile_generic "" "utils"
+ print_info 1 'gnupg: >> Copying to cache...'
+ [ -f "${TEMP}/${GPG_DIR}/g10/gpg" ] ||
+ gen_die 'gnupg executable does not exist!'
+ ${UTILS_CROSS_COMPILE}strip "${TEMP}/${GPG_DIR}/g10/gpg" ||
+ gen_die 'Could not strip gpg binary!'
+ bzip2 -z -c "${TEMP}/${GPG_DIR}/g10/gpg" > "${GPG_BINCACHE}" ||
+ gen_die 'Could not copy the gpg binary to the package directory, does the directory exist?'
+
+ cd "${TEMP}"
+ rm -rf "${GPG_DIR}" > /dev/null
+ fi
+}