diff --git a/src/Makefile b/src/Makefile index 6938aa10..a3eafc4e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -72,13 +72,10 @@ INCLUDES += -I$(UPX_UCLDIR)/include LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext)))) endif LIBS += -lucl -lz -# you should set envvar UPX_LZMADIR to point to your unpacked LZMA SDK +# LZMA from https://github.com/upx/upx-lzma-sdk include $(top_srcdir)/src/stub/src/c/Makevars.lzma -$(info UPX_LZMA_VERSION=$(UPX_LZMA_VERSION)) -ifneq ($(UPX_LZMA_VERSION),) DEFS += -DWITH_LZMA=$(UPX_LZMA_VERSION) INCLUDES += -I$(UPX_LZMADIR) -endif all: upx$(exeext) | .depend @@ -103,14 +100,7 @@ endif ##compress_lzma$(objext) : CXXFLAGS += -O3 -fomit-frame-pointer -compress_lzma$(objext) : CXXFLAGS += -Wno-cast-qual compress_lzma$(objext) : CXXFLAGS += -Wno-shadow -ifeq ($(UPX_LZMA_VERSION),0x443) -compress_lzma$(objext) : CXXFLAGS += -Wno-non-virtual-dtor -compress_lzma$(objext) : CXXFLAGS += -Wno-unused -endif -# needed for gcc-4.3: -compress_lzma$(objext) : CXXFLAGS += -Wno-error p_mach$(objext) : CXXFLAGS += -Wno-cast-align diff --git a/src/stub/src/c/Makevars.lzma b/src/stub/src/c/Makevars.lzma index fe069c8c..6537658c 100644 --- a/src/stub/src/c/Makevars.lzma +++ b/src/stub/src/c/Makevars.lzma @@ -1,28 +1,14 @@ -# you should set envvar UPX_LZMADIR to point to your unpacked LZMA SDK lzma443.tar.bz2 -# NOTE: only version 4.43 is currently sufficiently tested ! +# UPX unconditionally uses its own version in src/lzma-sdk because +# that version works fine since 2006 and that is the only version +# that is actually sufficiently tested!!! -ifndef UPX_LZMADIR -ifdef top_srcdir -ifneq ($(wildcard $(top_srcdir)/src/stub/src/c/lzma-sdk/C/.),) -UPX_LZMADIR := $(top_srcdir)/src/stub/src/c/lzma-sdk -else ifneq ($(wildcard $(top_srcdir)/src/lzma-sdk/C/.),) -UPX_LZMADIR := $(top_srcdir)/src/lzma-sdk -endif -endif -endif +override UPX_LZMADIR := $(top_srcdir)/src/lzma-sdk +override UPX_LZMA_VERSION := 0x443 -ifneq ($(wildcard $(UPX_LZMADIR)/C/7zVersion.h),) -UPX_LZMA_VERSION := $(shell perl -ne 'print "0x$$1$$2" if /^\s*\#\s*define\s+MY_VERSION\s+"(\d*)\.(\d\d)[\s\w]*"/;' $(UPX_LZMADIR)/C/7zVersion.h) -else ifneq ($(wildcard $(UPX_LZMADIR)/CPP/Windows/Time.cpp),) -UPX_LZMA_VERSION = 0x459 -else ifneq ($(wildcard $(UPX_LZMADIR)/C/7zBuf.h),) -UPX_LZMA_VERSION = 0x458 -else ifneq ($(wildcard $(UPX_LZMADIR)/C/CpuArch.h),) -UPX_LZMA_VERSION = 0x457 -else ifneq ($(wildcard $(UPX_LZMADIR)/CPP/7zip/.),) -UPX_LZMA_VERSION = 0x449 -else ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/Compress/LZ/Patricia/.),) -UPX_LZMA_VERSION = 0x442 -else ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),) -UPX_LZMA_VERSION = 0x443 +ifeq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),) + ifneq ($(wildcard $(top_srcdir)/.git/.),) + $(error ERROR: missing git submodule; run 'git submodule update --init --recursive') + else + $(error ERROR: missing directory src/lzma-sdk/; visit https://github.com/upx/upx-lzma-sdk ) + endif endif