Skip to content

Commit

Permalink
gzrt compilation in docker fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzalab committed Nov 7, 2024
1 parent ba59d0d commit 1a3a181
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
40 changes: 25 additions & 15 deletions recipes/gzrt/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,33 @@ if [ -z "$PREFIX" ]; then
exit 1
fi

# Ensure that the CC environment variable is set (for compiler)
if [ -z "$CC" ]; then
echo "CC environment variable not set, but it is required."
exit 1
export CFLAGS="${CFLAGS:-} -I${PREFIX}/include"
export LDFLAGS="${LDFLAGS:-} -L${PREFIX}/lib"
export CPATH="${PREFIX}/include"

# If-body reserved to docker build
if [ ! -f "$(command -v cc)" ]; then
# Ensure that the CC environment variable is set (for compiler)
if [ -z "$CC" ]; then
echo "CC environment variable not set, but it is required."
exit 1
fi

# Create a temporary directory
mkdir -p "$SRC_DIR/bin"

# Create a symlink named cc that points to $CC
CC_PATH="$(which "${CC}")"
if [ ! -x "${CC_PATH}" ]; then
echo "Could not find compiler at: ${CC_PATH}"
exit 1
fi
ln -sf "${CC_PATH}" "${SRC_DIR}/bin/cc"

# Prepend the temporary directory to the PATH
export PATH="${SRC_DIR}/bin:${PATH}"
fi

export CPATH=${PREFIX}/include

# Create a temporary directory
mkdir -p $SRC_DIR/bin

# Create a symlink named cc that points to $CC
ln -sf $(which $CC) $SRC_DIR/bin/cc

# Prepend the temporary directory to the PATH
export PATH=$SRC_DIR/bin:$PATH

if ! make; then
echo "Build failed"
exit 1
Expand Down
8 changes: 8 additions & 0 deletions recipes/gzrt/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ requirements:
test:
commands:
- gzrecover -h
# Create and test with a corrupted gzip file
- echo "test" | gzip > test.gz
- dd if=/dev/zero of=test.gz bs=1 count=1 seek=5 conv=notrunc
- gzrecover test.gz || [[ $? -eq 1 ]]

about:
home: https://www.urbanophile.com/arenn/hacking/gzrt
Expand All @@ -36,3 +40,7 @@ about:
gzrecover is a program that will attempt to extract any readable data
out of a gzip file that has been corrupted.
dev_url: https://github.com/arenn/gzrt

extra:
recipe-maintainers:
- mazzalab

0 comments on commit 1a3a181

Please sign in to comment.