Skip to content

Commit

Permalink
Add compiled packcheck to the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaov committed Apr 29, 2024
1 parent ee43ce0 commit 00b3934
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
Binary file added packcheck-x86_64-linux
Binary file not shown.
41 changes: 23 additions & 18 deletions packcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -882,22 +882,23 @@ find_binary () {
return 1
}

# We'll prep our system with default cabal and default ghc to build out
# executable until we manage a way to ship the executable properly.
install_packcheck_hs() {
local currentLocation=$(pwd)
cd "$PACKCHECK_SRC_DIR"
# Currently unsafe as we replace the already existing executable.
# TODO: Match version and proceed if it already exists
cabal install --installdir=$PACKCHECK_INSTALL_DIR --overwrite-policy=always
require_cmd "packcheck"
packcheck_sanity_check() {
show_step "Packcheck Sanity Check"

echo "Search Paths:"
ld --verbose | grep SEARCH_DIR | tr -s ' ;' \\012

echo "Linked libraries:"
ldd "$PACKCHECK_EXE"
}

ghcup_install() {
local toolName=$1
local toolVersion=$2
local toolInstallOptions

packcheck_sanity_check

if test "$tool" = "ghc"
then
tool_install_options=$GHCUP_GHC_OPTIONS $tool_ver
Expand All @@ -908,8 +909,7 @@ ghcup_install() {
PATH=$GHCUP_BIN:$PATH
echo "Added $GHCUP_BIN to PATH [$PATH]"

require_cmd "packcheck"
packcheck ghcup \
$PACKCHECK_EXE ghcup \
--url-prefix="$GHCUP_URL_PREFIX" \
--ghcup-version="$GHCUP_VERSION" \
--install-path="$GHCUP_PATH" \
Expand Down Expand Up @@ -1650,8 +1650,9 @@ build_hlint() {

run_hlint() {

require_cmd "packcheck"
packcheck \
packcheck_sanity_check

$PACKCHECK_EXE \
--url-prefix="$HLINT_URL_PREFIX" \
--hlint_version="$HLINT_VERSION" \
--install-path="$HLINT_PATH" \
Expand Down Expand Up @@ -1874,11 +1875,15 @@ GHCUP_PATH="${GHCUP_BIN}/ghcup"
GHCUP_URL_PREFIX="https://downloads.haskell.org/~ghcup"


PACKCHECK_DIR=$(dirname "$0") # NOTE: This is not a reliable way to get the
# directory where the file exists. But it works
# for now.
PACKCHECK_SOURCE_DIR="$PACKCHECK_DIR"
PACKCHECK_INSTALL_DIR="$LOCAL_BIN"
# NOTE: This is not a reliable way to get the directory where the file
# exists. But it works for now.
PACKCHECK_DIR=$(dirname "$0")
os=$(uname -s -m)
case "$os" in
"Linux x86_64") PACKCHECK_EXE_NAME="packcheck-x86_64-linux" ;;
*) echo "Unknown OS/Arch: $os"; exit 1;;
esac
PACKCHECK_EXE="$PACKCHECK_DIR/$PACKCHECK_EXE_NAME"

#------------------------------------------------------------------------------

Expand Down

0 comments on commit 00b3934

Please sign in to comment.