2
0
Эх сурвалжийг харах

ADD: libunrar build script

Alexander Koblov 2 сар өмнө
parent
commit
ab25a1ccd3

+ 5 - 0
libraries/src/libunrar/build-xp.bat

@@ -0,0 +1,5 @@
+set PATH=W:\Prog\MinGW\mingw32-12.2\bin;%PATH%
+
+rem Build unrar library
+
+mingw32-make clean lib

+ 40 - 0
libraries/src/libunrar/makefile

@@ -0,0 +1,40 @@
+#
+# Makefile for Windows - unrar.dll
+
+# MinGW
+CXX=g++
+CXXFLAGS=-O2 -std=c++11 -Wno-logical-op-parentheses -Wno-switch -Wno-dangling-else
+LIBFLAGS=-fPIC
+DEFINES=-DRARDLL -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_WIN32_WINNT=0x0501
+LDFLAGS=-Wl,--enable-stdcall-fixup -Wl,--strip-all
+
+##########################
+
+COMPILE=$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES)
+LINK=$(CXX)
+
+TARGET=unrar.dll
+
+LIB_OBJ=filestr.o scantree.o dll.o qopen.o version.o
+
+OBJECTS=rar.o strlist.o strfn.o pathfn.o smallfn.o global.o file.o filefn.o filcreat.o \
+	archive.o arcread.o unicode.o system.o crypt.o crc.o rawread.o encname.o \
+	resource.o match.o timefn.o rdwrfn.o consio.o options.o errhnd.o rarvm.o secpassword.o \
+	rijndael.o getbits.o sha1.o sha256.o blake2s.o hash.o extinfo.o extract.o volume.o \
+	list.o find.o unpack.o headers.o threadpool.o rs16.o cmddata.o ui.o largepage.o isnt.o motw.o
+
+version.o:
+	windres dll.rc -o version.o
+
+.cpp.o:
+	$(COMPILE) -c $<
+
+all:	lib
+
+clean:
+	@rm -f $(OBJECTS) $(LIB_OBJ)
+	@rm -f $(TARGET)
+
+lib:	CXXFLAGS+=$(LIBFLAGS)
+lib:	$(OBJECTS) $(LIB_OBJ)
+	$(LINK) -shared -static -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LIB_OBJ) dll.def

+ 47 - 0
libraries/src/libunrar/win-xp.patch

@@ -0,0 +1,47 @@
+diff --git a/isnt.cpp b/isnt.cpp
+index b89b2ce..42b231c 100644
+--- a/isnt.cpp
++++ b/isnt.cpp
+@@ -23,6 +23,9 @@ DWORD WinNT()
+ }
+ 
+ 
++#ifdef __GNUC__
++  #define WMI_IsWindows10() false
++#else
+ // Replace it with documented Windows 11 check when available.
+ #include <comdef.h>
+ #include <Wbemidl.h>
+@@ -89,6 +92,7 @@ static bool WMI_IsWindows10()
+ 
+   return Win10;
+ }
++#endif
+ 
+ 
+ // Replace it with actual check when available.
+diff --git a/os.hpp b/os.hpp
+index f7e841b..78c5751 100644
+--- a/os.hpp
++++ b/os.hpp
+@@ -37,6 +37,7 @@
+ #define _UNICODE // Set _T() macro to convert from narrow to wide strings.
+ #endif
+ 
++#undef _WIN32_WINNT
+ #define WINVER _WIN32_WINNT_WINXP
+ #define _WIN32_WINNT _WIN32_WINNT_WINXP
+ 
+diff --git a/system.cpp b/system.cpp
+index b8f96cb..08c6139 100644
+--- a/system.cpp
++++ b/system.cpp
+@@ -126,7 +126,7 @@ bool SetPrivilege(LPCTSTR PrivName)
+ #endif
+ 
+ 
+-#if defined(_WIN_ALL) && !defined(SFX_MODULE)
++#if defined(_WIN_ALL) && !defined(SFX_MODULE) && !defined(RARDLL)
+ void Shutdown(POWER_MODE Mode)
+ {
+   SetPrivilege(SE_SHUTDOWN_NAME);