Lines 775-777
Link Here
|
775 |
rm -rf "${GPG_DIR}" > /dev/null |
775 |
rm -rf "${GPG_DIR}" > /dev/null |
776 |
fi |
776 |
fi |
777 |
} |
777 |
} |
|
|
778 |
|
779 |
compile_klibc() { |
780 |
if [ -f "${KLIBC_BINCACHE}" ] |
781 |
then |
782 |
print_info 1 "klibc: >> Using cache" |
783 |
else |
784 |
local myARCH="${ARCH}" myABI="${ABI}" |
785 |
|
786 |
case ${ARCH} in |
787 |
amd64) a=x86_64 ;; |
788 |
mips) gen_die 'TODO: Use the $ABI' ;; |
789 |
x86) a=i386 ;; |
790 |
*) a=${ARCH} ;; |
791 |
esac |
792 |
KLIBCARCH=${a} |
793 |
|
794 |
case ${ARCH} in |
795 |
x86|x86_64) a=x86 ;; |
796 |
ppc*) a=powerpc ;; |
797 |
alpha|arm|ia64|m68k|mips|sh|sparc*) a=${ARCH} ;; |
798 |
*) gen_die "TODO: Update the code for your asm-ARCH symlink" ;; |
799 |
esac |
800 |
KLIBCASMARCH=${a} |
801 |
|
802 |
unset ABI ARCH KBUILD_OUTPUT |
803 |
|
804 |
print_info 1 'klibc: >> Unpacking klibc...' |
805 |
[ ! -f "${KLIBC_SRCTAR}" ] && |
806 |
gen_die "Could not find klibc source tarball: ${KLIBC_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!" |
807 |
cd "${TEMP}" |
808 |
rm -rf "${KLIBC_DIR}" |
809 |
tar -xpf "${KLIBC_SRCTAR}" |
810 |
[ ! -d "${KLIBC_DIR}" ] && |
811 |
gen_die "klibc directory ${KLIBC_DIR} invalid" |
812 |
cd "${KLIBC_DIR}" |
813 |
ln -snf "${KERNEL_DIR}" linux |
814 |
apply_patches klibc ${KLIBC_VER} |
815 |
print_info 1 'klibc: >> Compiling klibc...' |
816 |
compile_generic "all install" "utils" \ |
817 |
EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \ |
818 |
EXTRA_KLIBCLDFLAGS="-z,noexecstack" \ |
819 |
HOSTCC="${UTILS_CC}" \ |
820 |
CC="${UTILS_CC}" \ |
821 |
LD="${UTILS_LD}" \ |
822 |
AS="${UTILS_AS}" \ |
823 |
INSTALLDIR="${TEMP}/klibc-install" \ |
824 |
KLIBCARCH=${KLIBCARCH} \ |
825 |
KLIBCASMARCH=${KLIBCASMARCH} \ |
826 |
SHLIBDIR="${TEMP}/klibc-install/lib" \ |
827 |
libdir="${TEMP}/klibc-install/lib" \ |
828 |
bindir="${TEMP}/klibc-install/bin" \ |
829 |
mandir="${TEMP}/klibc-install/man" |
830 |
|
831 |
linkname="${TEMP}/klibc-install/include/asm" |
832 |
if [ -L "${linkname}" ] && [ ! -e "${linkname}" ]; then |
833 |
ln -snf asm-${KLIBCASMARCH} "${linkname}" |
834 |
fi |
835 |
|
836 |
print_info 1 ' >> Copying to bincache...' |
837 |
cd ${TEMP} |
838 |
rm -rf ${TEMP}/klibc-install/man |
839 |
for BIN in ${TEMP}/klibc-install/bin/* ; do |
840 |
if [ ${BIN} != "${TEMP}/klibc-install/bin/klcc" ] |
841 |
then |
842 |
rm -f ${BIN} |
843 |
fi |
844 |
done |
845 |
/bin/tar -jcpf "${KLIBC_BINCACHE}" klibc-install || |
846 |
gen_die 'Could not tar up the klibc binary!' |
847 |
[ -f "${KLIBC_BINCACHE}" ] || |
848 |
gen_die 'klibc cache not created!' |
849 |
cd ${TEMP} |
850 |
rm -rf "${KLIBC_DIR}" > /dev/null |
851 |
rm -rf "${TEMP}/klibc-install" > /dev/null |
852 |
fi |
853 |
} |
854 |
|
855 |
compile_v86d() { |
856 |
compile_klibc |
857 |
if [ ! -f "${V86D_BINCACHE}" ] |
858 |
then |
859 |
if [ -z "$(grep V86D ${KERNEL_DIR}/include/linux/connector.h)" ]; then |
860 |
gen_die "You need a kernel tree patched with uvesafb for v86d. Kernel not patched with uvesafb." |
861 |
fi |
862 |
print_info 1 'v86d: >> Unpacking v86d...' |
863 |
[ -f "${V86D_SRCTAR}" ] || |
864 |
gen_die "Could not find v86d source tarball: ${V86D_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!" |
865 |
cd "${TEMP}" |
866 |
rm -rf ${V86D_DIR} > /dev/null |
867 |
/bin/tar -jxpf ${V86D_SRCTAR} || |
868 |
gen_die 'Could not extract v86d source tarball!' |
869 |
[ -d "${V86D_DIR}" ] || |
870 |
gen_die 'v86d directory ${V86D_DIR} is invalid!' |
871 |
|
872 |
rm -rf "${TEMP}/klibc-install" > /dev/null |
873 |
/bin/tar -jxpf "${KLIBC_BINCACHE}" -C "${TEMP}" || |
874 |
gen_die "Could not extract klibc binary cache!"; |
875 |
local myTEMP=`echo ${TEMP} | sed -e 's@/@\\/@g' -e 's@\.@\\.@g' -e 's@-@\\-@g'` |
876 |
sed ${TEMP}/klibc-install/bin/klcc -i -e 's@\\/var\\/tmp\\/genkernel\\/.*\\/klibc\\-install@'${myTEMP}'\\/klibc\\-install@g' |
877 |
|
878 |
cd "${V86D_DIR}" |
879 |
apply_patches v86d ${V86D_VER} |
880 |
print_info 1 'v86d: >> Configuring...' |
881 |
|
882 |
./configure \ |
883 |
--with-klibc \ |
884 |
--with-x86emu >> ${LOGFILE} 2>&1 || |
885 |
gen_die 'Configure of v86d failed!' |
886 |
|
887 |
print_info 1 'v86d: >> Compiling...' |
888 |
compile_generic "" "utils" KDIR="${KERNEL_DIR}" CC="${TEMP}/klibc-install/bin/klcc" || |
889 |
gen_die 'Compiling v86d failed' |
890 |
print_info 1 ' >> Copying to bincache...' |
891 |
[ -f "${TEMP}/${V86D_DIR}/v86d" ] || |
892 |
gen_die 'v86d executable does not exist!' |
893 |
strip "${TEMP}/${V86D_DIR}/v86d" || |
894 |
gen_die 'Could not strip v86d binary!' |
895 |
bzip2 -z -c "${TEMP}/${V86D_DIR}/v86d" > "${V86D_BINCACHE}" || |
896 |
gen_die 'Could not copy the v86d binary to the package directory, does the directory exist?' |
897 |
|
898 |
cd "${TEMP}" |
899 |
rm -rf "${TEMP}/klibc-install" > /dev/null |
900 |
rm -rf "${V86D_DIR}" |
901 |
fi |
902 |
} |