add_executable(makecrct tools/makecrct.c)
target_include_directories(makecrct PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
- if(HAVE_OFF64_T)
- add_executable(example64 test/example.c)
- configure_test_executable(example64)
- target_link_libraries(example64 zlib)
- set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
- set(EXAMPLE64_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:example64>)
- add_test(NAME example64 COMMAND ${EXAMPLE64_COMMAND})
-
- add_executable(minigzip64 test/minigzip.c)
- configure_test_executable(minigzip64)
- if(NOT DEFINED BUILD_SHARED_LIBS)
- target_link_libraries(minigzip64 zlibstatic)
- else()
- target_link_libraries(minigzip64 zlib)
- endif()
- set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
- endif()
-
if(WITH_FUZZERS)
set(FUZZERS checksum compress example_small example_large example_flush example_dict minigzip)
file(GLOB ALL_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*")
endforeach()
endforeach()
- if(HAVE_OFF64_T)
- minigzip_stdio_cmp(minigzip64 "offset64" "test/data/paper-100k.pdf")
- endif()
-
minigzip_stdio_cmp(minigzip "detect-text" "test/data/lcet10.txt" -A)
minigzip_stdio_cmp(minigzip "detect-binary" "test/data/paper-100k.pdf" -A)
shared: examplesh$(EXE) minigzipsh$(EXE)
-all64: example64$(EXE) minigzip64$(EXE)
-
check: test
.SECONDARY:
minigzip.o:
$(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c
-example64.o:
- $(CC) $(CFLAGS) -DWITH_GZFILEOP -D_FILE_OFFSET_BITS=64 $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c
-
-minigzip64.o:
- $(CC) $(CFLAGS) -DWITH_GZFILEOP -D_FILE_OFFSET_BITS=64 $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c
-
makefixed.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makefixed.c
$(STRIP) $@
endif
-example64$(EXE): example64.o $(OBJG) $(STATICLIB)
- $(CC) $(LDFLAGS) -o $@ example64.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
-ifneq ($(STRIP),)
- $(STRIP) $@
-endif
-
-minigzip64$(EXE): minigzip64.o $(OBJG) $(STATICLIB)
- $(CC) $(LDFLAGS) -o $@ minigzip64.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
-ifneq ($(STRIP),)
- $(STRIP) $@
-endif
-
makefixed$(EXE): makefixed.o $(OBJG) $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ makefixed.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
@if [ -f test/Makefile ]; then $(MAKE) -C test clean; fi
rm -f *.o *.lo *~ \
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
- example64$(EXE) minigzip64$(EXE) \
checksum_fuzzer$(EXE) compress_fuzzer$(EXE) example_small_fuzzer$(EXE) example_large_fuzzer$(EXE) \
example_flush_fuzzer$(EXE) example_dict_fuzzer$(EXE) minigzip_fuzzer$(EXE) \
infcover makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) \
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
- ALL="${ALL} all64"
- TEST="${TEST} test64"
echo "Checking for off64_t... Yes." | tee -a configure.log
echo "Checking for fseeko... Yes." | tee -a configure.log
else
EOF
if try $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then
echo "Checking for _off64_t... Yes." | tee -a configure.log
- ALL="${ALL} all64"
- TEST="${TEST} test64"
else
echo "Checking for _off64_t... No." | tee -a configure.log
fi
if grep -q "^$obj:" Makefile; then
# Replace the existing line with a line with all dependences.
$(replace_in_file "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" Makefile)
-
- # Special case example64 and minigzip64.
- case "$obj" in
- example.o)
- $(replace_in_file "s#example64.o:.*#example64.o: \$(SRCDIR)/$short_name $includes#g" Makefile)
- ;;
- minigzip.o)
- $(replace_in_file "s#minigzip64.o:.*#minigzip64.o: \$(SRCDIR)/$short_name $includes#g" Makefile)
- ;;
- esac
else
# Append at the end of Makefile a new line with the header dependences.
echo "$obj: \$(SRCDIR)/$short_name $includes" >> Makefile
fi
@rm -f tmpsh_$$
-test64: check_cross_dep
- @TMP64=tmp64_$$; \
- if echo hello world | ${QEMU_RUN} ../minigzip64$(EXE) | ${QEMU_RUN} ../minigzip64$(EXE) -d && ${QEMU_RUN} ../example64$(EXE) $$TMP64; then \
- echo ' *** zlib 64-bit test OK ***'; \
- else \
- echo ' *** zlib 64-bit test FAILED ***'; exit 1; \
- fi
- @rm -f tmp64_$$
-
cvetests: testCVEinputs
# Tests requiring zlib-ng to be built with --zlib-compat