Moves BZ_UNIX, BZ_LCCWIN32 defines out of bzip2.c and bzip2recover.c and into the build tooling (cmake, meson, and nmake).

This commit is contained in:
Micah Snyder 2019-09-14 18:48:40 -04:00
parent d0dae15260
commit b52681fab6
5 changed files with 14 additions and 30 deletions

View File

@ -13,6 +13,14 @@ set(LT_CURRENT 1)
set(LT_REVISION 7)
set(LT_AGE 0)
if(WIN32)
add_definitions(-DBZ_LCCWIN32)
add_definitions(-DBZ_UNIX=0)
else()
add_definitions(-DBZ_UNIX)
add_definitions(-DBZ_LCCWIN32=0)
endif()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
include(Version)

24
bzip2.c
View File

@ -18,30 +18,6 @@
------------------------------------------------------------------ */
/* Place a 1 beside your platform, and 0 elsewhere.
Generic 32-bit Unix.
Also works on 64-bit Unix boxes.
This is the default.
*/
#define BZ_UNIX 1
/*--
Win32, as seen by Jacob Navia's excellent
port of (Chris Fraser & David Hanson)'s excellent
lcc compiler. Or with MS Visual C.
This is selected automatically if compiled by a compiler which
defines _WIN32, not including the Cygwin GCC.
--*/
#define BZ_LCCWIN32 0
#if defined(_WIN32) && !defined(__CYGWIN__)
#undef BZ_LCCWIN32
#define BZ_LCCWIN32 1
#undef BZ_UNIX
#define BZ_UNIX 0
#endif
/*---------------------------------------------*/
/*--
Some stuff for all platforms.

View File

@ -20,11 +20,6 @@
/* This program is a complete hack and should be rewritten properly.
It isn't very complicated. */
/* Place a 1 beside your platform, and 0 elsewhere.
Generic 32-bit Unix.
Also works on 64-bit Unix boxes.
This is the default.
*/
#if BZ_UNIX
# include <fcntl.h>
# include <sys/types.h>

View File

@ -4,7 +4,7 @@
# Fixed up by JRS for bzip2-0.9.5d release.
CC=cl
CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo
CFLAGS= -DWIN32 -DBZ_LCCWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo
RC=rc
OBJS= blocksort.obj \

View File

@ -66,6 +66,11 @@ add_project_arguments('-D_GNU_SOURCE', language : 'c')
if host_machine.system() == 'windows'
add_project_arguments('-D_WIN32', language : 'c')
add_project_arguments('-DBZ_LCCWIN32', language : 'c')
add_project_arguments('-DBZ_UNIX=0', language : 'c')
else
add_project_arguments('-DBZ_UNIX', language : 'c')
add_project_arguments('-DBZ_LCCWIN32=0', language : 'c')
endif
c_args = []