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

Commit

Permalink
specfile fix-up and gfortran install fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mingwandroid committed Jun 2, 2017
1 parent d80235b commit d2def26
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 deletions.
24 changes: 23 additions & 1 deletion cross-compilers/compilers_generic/install-g++.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ make -C $CHOST/libstdc++-v3/python prefix=${PREFIX} install

# Probably don't want to do this for cross-compilers
# mkdir -p ${PREFIX}/share/gdb/auto-load/usr/lib/
# cp ${SRC_DIR}/gcc_built/${CHOST}/sysroot/lib/libstdc++.so.6.*-gdb.py ${PREFIX}/share/gdb/auto-load/usr/lib/
# cp ${SRC_DIR}/gcc_built/${CHOST}/sysroot/lib/libstdc++.so.*-gdb.py ${PREFIX}/share/gdb/auto-load/usr/lib/

make -C libcpp prefix=${PREFIX} install

Expand All @@ -33,6 +33,28 @@ popd
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}-g++ $PREFIX/bin/${CHOST}-g++.bin
echo '#!/bin/sh' > $PREFIX/bin/${CHOST}-gxx
echo $PREFIX/bin/${CHOST}-g++.bin -specs=$specdir/specs '"$@"' >> $PREFIX/bin/${CHOST}-g++
chmod +x $PREFIX/bin/${CHOST}-g++

# many packages expect this symlink
[[ -f ${PREFIX}/bin/$CHOST-c++ ]] && rm ${PREFIX}/bin/$CHOST-c++
pushd ${PREFIX}/bin
ln -s $CHOST-g++ $CHOST-c++
popd

mkdir -p ${PREFIX}/etc/conda/{de,}activate.d
cp "${SRC_DIR}"/activate-g++.sh ${PREFIX}/etc/conda/activate.d/activate-${PKG_NAME}.sh
cp "${SRC_DIR}"/deactivate-g++.sh ${PREFIX}/etc/conda/deactivate.d/deactivate-${PKG_NAME}.sh
26 changes: 26 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,11 @@ pushd ${SRC_DIR}/.build/${CHOST}/build/build-cc-gcc-final/
make -C ${CHOST}/libgcc prefix=${PREFIX} install
# rm ${PREFIX}/lib/libgcc_s.so*

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 Expand Up @@ -125,6 +130,27 @@ fi
install -Dm644 $SRC_DIR/.build/src/gcc-${PKG_VERSION}/COPYING.RUNTIME \
${PREFIX}/share/licenses/gcc/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)`
$PREFIX/bin/${CHOST}-gcc -dumpspecs > $specdir/specs
# We use double quotes here because we want $PREFIX and $CHOST to be expanded at build time
# and recorded in the specs file. It will undergo a prefix replacement when our compiler
# package is installed.
sed -i -e "/\*link_libgcc:/,+1 s+%.*+& -R${PREFIX}/${CHOST}/lib+" $specdir/specs

mv $PREFIX/bin/${CHOST}-gcc $PREFIX/bin/${CHOST}-gcc.bin
echo '#!/bin/sh' > $PREFIX/bin/${CHOST}-gcc
echo $PREFIX/bin/${CHOST}-gcc.bin -specs=$specdir/specs '"$@"' >> $PREFIX/bin/${CHOST}-gcc
chmod +x $PREFIX/bin/${CHOST}-gcc

mkdir -p ${PREFIX}/etc/conda/{de,}activate.d
cp "${SRC_DIR}"/activate-gcc.sh ${PREFIX}/etc/conda/activate.d/activate-${PKG_NAME}.sh
cp "${SRC_DIR}"/deactivate-gcc.sh ${PREFIX}/etc/conda/deactivate.d/deactivate-${PKG_NAME}.sh
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 d2def26

Please sign in to comment.