Skip to content

Commit

Permalink
LZ4 removal for make and meson, relates to radareorg#19849 ##build
Browse files Browse the repository at this point in the history
  • Loading branch information
MewtR committed Jun 18, 2023
1 parent c9698f6 commit 939b507
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 3,732 deletions.
5 changes: 5 additions & 0 deletions config-user.mk.acr
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ LIBXXHASH=@LIBXXHASH@
USE_SYSLZ4=@USE_SYSLZ4@
USE_SMALLZ4=@USE_SMALLZ4@

ifeq ($(USE_SYSLZ4),1)
LZ4_LDFLAGS=@LZ4_LDFLAGS@
LZ4_CFLAGS=@LZ4_CFLAGS@
endif

ifeq ($(HAVE_LIB_SSL),1)
SSL_CFLAGS=@SSL_CFLAGS@
SSL_LDFLAGS=@SSL_LDFLAGS@
Expand Down
32 changes: 10 additions & 22 deletions configure
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# This script was automatically generated by ACR v2.1.1
# This script was automatically generated by ACR v2.1.2
# @author: pancake <nopcode.org>
# @url: http://www.nopcode.org
# @repo: git clone https://github.com/radare/acr
Expand Down Expand Up @@ -34,7 +34,6 @@ USE_CS5=0
USE_CS4=0
WITH_CAPSTONE=0
WITH_SYSLZ4=0
WITH_SMALLZ4=0
USE_ZIP=0
USE_XXHASH=0
WITH_GPL=1
Expand Down Expand Up @@ -188,8 +187,7 @@ System types:
--target=TARGET configure for building compilers for TARGET [HOST]
EOF2

printf "
Optional Features:
printf "\nOptional Features:
--disable-debugger disable native debugger features
--with-sysmagic force to use system's magic
--disable-threads disable use of thread apis
Expand All @@ -206,7 +204,6 @@ Optional Features:
--with-capstone4 build v4 branch of capstone
--with-syscapstone force to use system-wide capstone
--with-syslz4 force to use system's liblz4
--with-smallz4 build with smallz4 use it as the lz4 decompressor
--with-syszip force to use system's libzip and zlib
--with-sysxxhash force to use system's xxhash
--without-gpl do not build GPL code (grub, cxx, ... )
Expand All @@ -218,20 +215,16 @@ Optional Features:
--with-ostype Choose OS ( android windows wsl mingw32 bsd solaris gnulinux darwin haiku ) (USEROSTYPE=auto)
--with-libversion specify different libversion (LIBVERSION=xxx)
--without-jemalloc build without jemalloc
--with-checks-level value between 0 and 3 to enable different level of assert (see R_CHECKS_LEVEL) (R_CHECKS_LEVEL=2)
"
printf "
Some influential environment variables:
--with-checks-level value between 0 and 3 to enable different level of assert (see R_CHECKS_LEVEL) (R_CHECKS_LEVEL=2)\n"
printf "\nSome influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
"
printf "
Report bugs to: pancake <pancake@nopcode.org>"
CPP C preprocessor\n"
printf "\nReport bugs to: pancake <pancake@nopcode.org>"
echo ""
exit 0
}
Expand All @@ -258,7 +251,7 @@ if [ "$QUIET" = 1 ]; then
echo "5.8.9"
exit 0
fi
echo "radare2-5.8.9 configuration script done with acr v2.1.1.
echo "radare2-5.8.9 configuration script done with acr v2.1.2.
The 'Free Software Foundation' message is only for autodetection.
Originally written by pancake <nopcode.org>."
exit 0
Expand Down Expand Up @@ -295,7 +288,7 @@ echo "LANGS: c"
echo "REQUIRED: libdl"
echo "OPTIONAL: libmagic libz libzip libxxhash libssl liblibuv>=1.0.0"
echo "PKGCONFIG: capstone liblz4 openssl libuv"
echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disable-loadlibs --enable-threadsafety --without-dylink --without-fork --without-ptrace-wrap --without-gperf --without-capstone --with-libr --with-static-themes --with-capstone5 --with-capstone4 --with-syscapstone --with-syslz4 --with-smallz4 --with-syszip --with-sysxxhash --without-gpl --with-ssl --with-ssl-crypto --with-libuv --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc --with-checks-level=2"
echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disable-loadlibs --enable-threadsafety --without-dylink --without-fork --without-ptrace-wrap --without-gperf --without-capstone --with-libr --with-static-themes --with-capstone5 --with-capstone4 --with-syscapstone --with-syslz4 --with-syszip --with-sysxxhash --without-gpl --with-ssl --with-ssl-crypto --with-libuv --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc --with-checks-level=2"
exit 0
;;
--cache-file)
Expand Down Expand Up @@ -363,7 +356,6 @@ echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disabl
"--with-capstone4") USE_CS4="1"; ;;
"--with-syscapstone") WITH_CAPSTONE="1"; ;;
"--with-syslz4") WITH_SYSLZ4="1"; ;;
"--with-smallz4") WITH_SMALLZ4="1"; ;;
"--with-syszip") USE_ZIP="1"; ;;
"--with-sysxxhash") USE_XXHASH="1"; ;;
"--without-gpl") WITH_GPL="0"; ;;
Expand Down Expand Up @@ -393,7 +385,7 @@ parse_options "$1"
shift
done

ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER PKGCFG_LIBDIR PKGCFG_INCDIR PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS PKGCONFIG R2_BUILDSYSTEM HAVE_PATCH PATCH HAVE_AR AR HAVE_GIT GIT HAVE_GPERF GPERF HAVE_LIB_MAGIC HAVE_LINUX_CAN_H USE_MAGIC USE_LIB_MAGIC LIBMAGIC WANT_THREADS LOADLIBS R_CRITICAL_ENABLED WANT_DYLINK HAVE_FORK WANT_PTRACE_WRAP WANT_GPERF WANT_CAPSTONE WITH_LIBR WITH_STATIC_THEMES USE_CS5 USE_CS4 WITH_CAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE LZ4_CFLAGS LZ4_LDFLAGS HAVE_PKGCFG_LIBLZ4 WITH_SYSLZ4 USE_SYSLZ4 WITH_SMALLZ4 USE_SMALLZ4 HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP HAVE_LIB_XXHASH USE_XXHASH USE_LIB_XXHASH LIBXXHASH WITH_GPL HAVE_DECL_ADDR_NO_RANDOMIZE HAVE_DECL___GLIBC__ HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO HAVE_EXPLICIT_MEMSET HAVE_CLOCK_NANOSLEEP HAVE_SIGACTION HAVE_CLOCK_GETTIME CLOCK_LDFLAGS SUPPORT_GNU99 HAVE_LIB_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_SSL WANT_SSL_CRYPTO WANT_LIBUV HAVE_LIBUV_VERSION_1_0_0 LIBUV_CFLAGS LIBUV_LDFLAGS HAVE_PKGCFG_LIBUV HAVE_LIBUV USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC HAVE_PTRACE USE_PTRACE_WRAP R_CHECKS_LEVEL"
ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER PKGCFG_LIBDIR PKGCFG_INCDIR PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS PKGCONFIG R2_BUILDSYSTEM HAVE_PATCH PATCH HAVE_AR AR HAVE_GIT GIT HAVE_GPERF GPERF HAVE_LIB_MAGIC HAVE_LINUX_CAN_H USE_MAGIC USE_LIB_MAGIC LIBMAGIC WANT_THREADS LOADLIBS R_CRITICAL_ENABLED WANT_DYLINK HAVE_FORK WANT_PTRACE_WRAP WANT_GPERF WANT_CAPSTONE WITH_LIBR WITH_STATIC_THEMES USE_CS5 USE_CS4 WITH_CAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE LZ4_CFLAGS LZ4_LDFLAGS HAVE_PKGCFG_LIBLZ4 WITH_SYSLZ4 USE_SYSLZ4 HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP HAVE_LIB_XXHASH USE_XXHASH USE_LIB_XXHASH LIBXXHASH WITH_GPL HAVE_DECL_ADDR_NO_RANDOMIZE HAVE_DECL___GLIBC__ HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO HAVE_EXPLICIT_MEMSET HAVE_CLOCK_NANOSLEEP HAVE_SIGACTION HAVE_CLOCK_GETTIME CLOCK_LDFLAGS SUPPORT_GNU99 HAVE_LIB_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_SSL WANT_SSL_CRYPTO WANT_LIBUV HAVE_LIBUV_VERSION_1_0_0 LIBUV_CFLAGS LIBUV_LDFLAGS HAVE_PKGCFG_LIBUV HAVE_LIBUV USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC HAVE_PTRACE USE_PTRACE_WRAP R_CHECKS_LEVEL"

create_environ

Expand Down Expand Up @@ -661,15 +653,11 @@ tmp=`${PKGCONFIG} --libs liblz4 2>/dev/null`
if [ $? = 0 ]; then
echo yes; HAVE_PKGCFG_LIBLZ4=1;
LZ4_LDFLAGS=$tmp; fi; fi
if [ 11 = "$WITH_SYSLZ4$LZ4_CFLAGS" ]; then
if [ 11 = "$WITH_SYSLZ4$HAVE_PKGCFG_LIBLZ4" ]; then

USE_SYSLZ4="1"
else
USE_SYSLZ4="0"; fi
if [ "$WITH_SMALLZ4" = "1" ]; then
USE_SMALLZ4="1"
else
USE_SMALLZ4="0"; fi
check_library HAVE_LIB_Z z 0
check_library HAVE_LIB_ZIP zip 0
if [ 11 = "$HAVE_LIB_Z$USE_ZIP" ]; then
Expand Down
10 changes: 1 addition & 9 deletions configure.acr
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,13 @@ IFAND WITH_CAPSTONE HAVE_PKGCFG_CAPSTONE {
(( LZ4 ))
PKGCFG LZ4_CFLAGS LZ4_LDFLAGS liblz4
ARG_WITH WITH_SYSLZ4 syslz4 force to use system's liblz4 ;
IFAND WITH_SYSLZ4 LZ4_CFLAGS {
IFAND WITH_SYSLZ4 HAVE_PKGCFG_LIBLZ4 {
USE_SYSLZ4 = 1 ;
}{
USE_SYSLZ4 = 0 ;

}

(( SMALLZ4 ))
ARG_WITH WITH_SMALLZ4 smallz4 build with smallz4 use it as the lz4 decompressor ;
IF WITH_SMALLZ4 {
USE_SMALLZ4 = 1 ;
}{
USE_SMALLZ4 = 0 ;
}

(( ZIP ))
CHKLIB z
CHKLIB zip
Expand Down
3 changes: 3 additions & 0 deletions libr/bin/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ r_bin_sources += r_bin_d_sources

r_bin_inc = [platform_inc, include_directories('mangling', 'format')]

if not get_option('use_sys_lz4')
library_cflags += ['-DUSE_SMALLZ4']
endif
r_bin = library('r_bin', r_bin_sources,
include_directories: r_bin_inc,
c_args: ['-DR_API_BIN_ONLY=1'] + library_cflags,
Expand Down
11 changes: 4 additions & 7 deletions libr/util/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,18 @@ OBJS+=d/iso8859_1.o
endif

ifeq ($(USE_SYSLZ4),1)
CFLAGS+=@LZ4_CFLAGS@
CFLAGS+=${LZ4_CFLAGS}
PCLIBS+=@LZ4_LDFLAGS@
LDFLAGS+=${LZ4_LDFLAGS}
else
OBJS+=$(SHLR)/lz4/lz4.o
CFLAGS+=-DUSE_SMALLZ4
OBJS+=$(SHLR)/smallz4/smallz4cat.o
endif

OBJS+=big_gmp.o
OBJS+=big_ssl.o
OBJS+=big.o

ifeq ($(USE_SMALLZ4),1)
CFLAGS+=-DUSE_SMALLZ4
OBJS+=$(SHLR)/smallz4/smallz4cat.o
endif

CWD=$(shell pwd)

LDFLAGS+=${BN_LIBS}
Expand Down
9 changes: 4 additions & 5 deletions libr/util/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ if get_option('sdb_cgen')
r_util_sources += r_util_d_sources
endif

r_util_deps = [ldl, mth, spp_dep, pth, utl, sdb_dep, lz4_dep, zlib_dep, platform_deps]
if not get_option('use_sys_lz4')
library_cflags += ['-DUSE_SMALLZ4']
endif

r_util_deps = [ldl, mth, spp_dep, pth, utl, sdb_dep, lz4_dep, zlib_dep, platform_deps]

if host_machine.system().startswith('freebsd') or host_machine.system().startswith('netbsd') or host_machine.system().startswith('haiku')
# backtrace_symbols_fd requires -lexecinfo
Expand All @@ -118,10 +121,6 @@ else
r_util_sources += ['big.c']
endif

if get_option('use_smallz4')
library_cflags += ['-DUSE_SMALLZ4']
r_util_deps += [smallz4_dep]
endif

r_util = library('r_util', r_util_sources,
include_directories: platform_inc,
Expand Down
3 changes: 2 additions & 1 deletion libr/util/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <r_util.h>
#include <zlib.h>
#include "../../../shlr/lz4/lz4.h"

// set a maximum output buffer of 50MB
#define MAXOUT 50000000
Expand Down Expand Up @@ -35,6 +34,8 @@ unsigned char smallz4GetByte(void *userPtr) {
struct UserPtr* user = (struct UserPtr*)userPtr;
return *(user->input + (user->inputPos++));
}
#else
#include <lz4.h>
#endif

static const char *gzerr(int n) {
Expand Down
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ if get_option('local') and get_option('default_library') == 'shared'
rpath_lib = '$ORIGIN'
endif

subdir('shlr/lz4')
subdir('shlr/smallz4')
subdir('libr/util')
subdir('libr/socket')
Expand Down
1 change: 0 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ option('use_sys_magic', type: 'boolean', value: false)
option('use_sys_zip', type: 'boolean', value: false)
option('use_sys_zlib', type: 'boolean', value: false)
option('use_sys_lz4', type: 'boolean', value: false)
option('use_smallz4', type: 'boolean', value: false)
option('use_sys_xxhash', type: 'boolean', value: false)
option('use_ssl', type: 'boolean', value: false)
option('use_ssl_crypto', type: 'boolean', value: false)
Expand Down
1 change: 0 additions & 1 deletion shlr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ SHLRS+=capstone/libcapstone.a
SHLRS+=gdb/lib/libgdbr.a
SHLRS+=grub/libgrubfs.a
SHLRS+=java/libr_java.a
SHLRS+=lz4/liblz4.a
SHLRS+=qnx/lib/libqnxr.a
SHLRS+=winkd/libr_winkd.a
SHLRS+=zip/librz.a
Expand Down
2 changes: 0 additions & 2 deletions shlr/lz4/.gitignore

This file was deleted.

24 changes: 0 additions & 24 deletions shlr/lz4/LICENSE

This file was deleted.

0 comments on commit 939b507

Please sign in to comment.