Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Commit

Permalink
specfile + gfortran fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mingwandroid committed Jun 2, 2017
1 parent a69bede commit 2efb442
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cross-compilers/compilers_generic/install-gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ pushd ${SRC_DIR}/.build/${CHOST}/build/build-cc-gcc-final/
make -C ${CHOST}/libgcc prefix=${PREFIX} install
# rm ${PREFIX}/lib/libgcc_s.so*

mkdir -p $PREFIX/$CHOST/sysroot/lib

cp ${SRC_DIR}/gcc_built/$CHOST/sysroot/lib/libgomp.so* $PREFIX/$CHOST/sysroot/lib
if [ -e ${SRC_DIR}/gcc_built/$CHOST/sysroot/lib/libquadmath.so* ]; then
cp ${SRC_DIR}/gcc_built/$CHOST/sysroot/lib/libquadmath.so* $PREFIX/$CHOST/sysroot/lib
fi

make prefix=${PREFIX} install-libcc1
install -d ${PREFIX}/share/gdb/auto-load/usr/lib

Expand Down
24 changes: 23 additions & 1 deletion cross-compilers/compilers_generic/install-gfortran.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,45 @@ export PATH=${SRC_DIR}/gcc_built/bin:${SRC_DIR}/.build/${CHOST}/buildtools/bin:$

pushd $SRC_DIR/.build/$CHOST/build/build-cc-gcc-final/

make -C $CHOST/libgfortran prefix=$PREFIX install
# adapted from Arch install script from https://github.com/archlinuxarm/PKGBUILDs/blob/master/core/gcc/PKGBUILD
# We cannot make install since .la files are not relocatable so libtool deliberately prevents it:
# libtool: install: error: cannot install `libgfortran.la' to a directory not ending in ${SRC_DIR}/work/gcc_built/${CHOST}/lib/../lib
make -C $CHOST/libgfortran prefix=$PREFIX all-multi libgfortran.spec ieee_arithmetic.mod ieee_exceptions.mod ieee_features.mod config.h
if [[ -d $CHOST/libgomp ]]; then
make -C $CHOST/libgomp prefix=$PREFIX install-nodist_fincludeHEADERS
fi
make -C gcc prefix=$PREFIX fortran.install-{common,man,info}
install -Dm755 gcc/f951 $PREFIX/${_libdir}/f951

mkdir -p $PREFIX/$CHOST/sysroot/lib
cp $CHOST/libgfortran/libgfortran.spec $PREFIX/$CHOST/sysroot/lib

pushd $PREFIX/bin
ln -s $CHOST-gfortran $CHOST-f95
popd

popd

cp ${SRC_DIR}/gcc_built/$CHOST/sysroot/lib/libgfortran.so* $PREFIX/$CHOST/sysroot/lib
# Install Runtime Library Exception
install -Dm644 $SRC_DIR/.build/src/gcc-${PKG_VERSION}/COPYING.RUNTIME \
${PREFIX}/share/licenses/gcc-fortran/RUNTIME.LIBRARY.EXCEPTION

# generate specfile so that we can patch loader link path
# link_libgcc should have the gcc's own libraries by default (-R)
# so that LD_LIBRARY_PATH isn't required for basic libraries.
#
# GF method here to create specs file and edit it. The other methods
# tried had no effect on the result. including:
# setting LINK_LIBGCC_SPECS on configure
# setting LINK_LIBGCC_SPECS on make
# setting LINK_LIBGCC_SPECS in gcc/Makefile
specdir=`dirname $($PREFIX/bin/${CHOST}-gcc -print-libgcc-file-name -no-canonical-prefixes)`
mv $PREFIX/bin/${CHOST}-gfortran $PREFIX/bin/${CHOST}-gfortran.bin
echo '#!/bin/sh' > $PREFIX/bin/${CHOST}-gfortran
echo $PREFIX/bin/${CHOST}-gfortran.bin -specs=$specdir/specs '"$@"' >> $PREFIX/bin/${CHOST}-gfortran
chmod +x $PREFIX/bin/${CHOST}-gfortran

mkdir -p ${PREFIX}/etc/conda/{de,}activate.d
cp "${SRC_DIR}"/activate-gfortran.sh ${PREFIX}/etc/conda/activate.d/activate-${PKG_NAME}.sh
cp "${SRC_DIR}"/deactivate-gfortran.sh ${PREFIX}/etc/conda/deactivate.d/deactivate-${PKG_NAME}.sh

0 comments on commit 2efb442

Please sign in to comment.