Skip to content

Commit

Permalink
Package full build
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya Alok <[email protected]>
  • Loading branch information
MrAdityaAlok committed Jan 5, 2025
1 parent b604698 commit c76f437
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 47 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ jobs:
exit 0
fi
./run-docker.sh \
./compile.sh ./out-dir ${{ matrix.target_arch }}
./run-docker.sh ./compile.sh ./out-dir ${{ matrix.target_arch }}
- name: Store files
uses: actions/upload-artifact@v3
Expand Down
85 changes: 40 additions & 45 deletions packages/ghc-cross/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,53 +34,48 @@ termux_step_pre_configure() {
termux_step_make() {
unset CFLAGS CPPFLAGS LDFLAGS # For stage0 compilation.

./hadrian/build binary-dist-dir --flavour=quickest+no_profiled_libs --docs=none \
./hadrian/build binary-dist-xz --flavour=quickest+no_profiled_libs --docs=none \
"stage1.*.ghc.*.opts += -optl-landroid-posix-semaphore"
}

termux_step_make_install() {

cd ./_build/bindist/ghc-* || exit 1

./configure --prefix="$TERMUX_PREFIX" --host="$target"
make install

# We may build GHC with `llc-9` etc., but only `llc` is present in Termux
sed -i 's/"LLVM llc command", "llc.*"/"LLVM llc command", "llc"/' \
"$TERMUX_PREFIX/lib/$target-ghc-$TERMUX_PKG_VERSION/lib/settings" || :
sed -i 's/"LLVM opt command", "opt.*"/"LLVM opt command", "opt"/' \
"$TERMUX_PREFIX/lib/$target-ghc-$TERMUX_PKG_VERSION/lib/settings" || :
}
cp ./_build/bindist/ghc-*.tar.xz "$TAR_OUTPUT_DIR"/
exit

termux_step_install_license() {
install -Dm600 -t "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME" \
"$TERMUX_PKG_SRCDIR/LICENSE"
}

termux_step_post_massage() {
# Package for Termux ci:

local host_platform="${TERMUX_HOST_PLATFORM}"
[ "${TERMUX_ARCH}" = "arm" ] && host_platform="armv7a-linux-androideabi"

for f in "bin/${host_platform}"-{ghc,ghc-$TERMUX_PKG_VERSION,ghc-pkg*,hsc2hs,hp2ps}; do
# Fix shebang and $topdir.
sed -i -e "s|^#!${TERMUX_PREFIX}/bin/sh|#!/usr/bin/sh|" \
-e "s|${host_platform}-ghc-${TERMUX_PKG_VERSION}|ghc-${TERMUX_PKG_VERSION}|g" \
"$f"
biname="$(basename "$f")"
mv "$f" "bin/${biname/${host_platform}-/}"
done

rm -rf "bin/$host_platform"-* || : # Remove rest binaries.

mkdir -p lib/ghc-"${TERMUX_PKG_VERSION}"/bin
cp lib/"${host_platform}"-ghc-"${TERMUX_PKG_VERSION}"/settings lib/ghc-"${TERMUX_PKG_VERSION}"
cp lib/"${host_platform}"-ghc-"${TERMUX_PKG_VERSION}"/bin/{ghc,ghc-pkg,hsc2hs,hp2ps,unlit} lib/ghc-"${TERMUX_PKG_VERSION}"/bin

tar -cvzf "${TAR_OUTPUT_DIR}/ghc-cross-bin-${TERMUX_PKG_VERSION}-${TERMUX_ARCH}.tar.xz" \
lib/ghc-"${TERMUX_PKG_VERSION}" \
bin/

exit
}
# termux_step_make_install() {

# cd ./_build/bindist/ghc-* || exit 1

# ./configure --prefix="$TERMUX_PREFIX" --host="$target"
# make install

# }

# termux_step_install_license() {
# install -Dm600 -t "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME" \
# "$TERMUX_PKG_SRCDIR/LICENSE"
# }
#
# termux_step_post_massage() {
# # Package for Termux ci:
#
# local host_platform="${TERMUX_HOST_PLATFORM}"
# [ "${TERMUX_ARCH}" = "arm" ] && host_platform="armv7a-linux-androideabi"
#
# for f in "bin/${host_platform}"-{ghc,ghc-$TERMUX_PKG_VERSION,ghc-pkg*,hsc2hs,hp2ps}; do
# binname="$(basename "$f")"
# mv "$f" "bin/${binname/${host_platform}-/}"
# done
#
# rm -rf "bin/$host_platform"-* || : # Remove rest binaries.
#
# mkdir -p lib/ghc-"${TERMUX_PKG_VERSION}"/bin
# cp lib/"${host_platform}"-ghc-"${TERMUX_PKG_VERSION}"/settings lib/ghc-"${TERMUX_PKG_VERSION}"
# cp lib/"${host_platform}"-ghc-"${TERMUX_PKG_VERSION}"/bin/{ghc,ghc-pkg,hsc2hs,hp2ps,unlit} lib/ghc-"${TERMUX_PKG_VERSION}"/bin
#
# tar -cvzf "${TAR_OUTPUT_DIR}/ghc-cross-bin-${TERMUX_PKG_VERSION}-${TERMUX_ARCH}.tar.xz" \
# lib/ghc-"${TERMUX_PKG_VERSION}" \
# bin/
#
# exit
# }

0 comments on commit c76f437

Please sign in to comment.