]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Clean up CMakeLists.txt and remove Amiga specific locale.h guard
authorCameron Armstrong (Nightfox) <cameronscottarmstrong@gmail.com>
Sat, 22 Jun 2024 10:49:50 +0000 (18:49 +0800)
committerCameron Armstrong (Nightfox) <cameronscottarmstrong@gmail.com>
Tue, 24 Dec 2024 02:09:50 +0000 (10:09 +0800)
.gitignore
CMakeLists.txt
README.md

index 4b7da9f24176b38633cdd0b109218ce25f41bf10..e50a2834262916f78ceaf28a40d3858ea2bc6701 100644 (file)
@@ -10,6 +10,7 @@
 *.save
 *.autosav
 *.autosave
+.DS_Store
 
 # Tests
 /tests/Makefile
index 41c0d89c1090b71c93678a7baae9523099169c81..ed877e3539d099125849a35aa0ac6b4aa8024770 100644 (file)
@@ -69,17 +69,13 @@ option(DISABLE_JSON_PATCH             "Disable JSON patch (RFC6902) support."
 option(NEWLOCALE_NEEDS_FREELOCALE     "Work around newlocale bugs in old FreeBSD by calling freelocale"  OFF)
 option(BUILD_APPS                     "Default to building apps" ON)
 
-if (UNIX OR MINGW OR CYGWIN OR AMIGA)
-    list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
-endif()
-
 if (${CMAKE_SYSTEM_NAME} STREQUAL "AmigaOS")
     set(AMIGA ON)
     set(DISABLE_THREAD_LOCAL_STORAGE ON)
     set(ENABLE_THREADING OFF)
     set(BUILD_SHARED_LIBS OFF)
     set(BUILD_APPS OFF)
-    list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+    set(DISABLE_STATIC_FPIC ON)
     if ($ENV{CROSS_PFX} STREQUAL "m68k-amigaos")
         set(AMIGA_M68K ON)
         set(BUILD_TESTING OFF)
@@ -105,6 +101,10 @@ else()
     message(STATUS "Building for ${CMAKE_SYSTEM_NAME}")
 endif()
 
+if (UNIX OR MINGW OR CYGWIN OR AMIGA)
+    list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+endif()
+
 if (BUILD_SHARED_LIBS)
     add_definitions(-D JSON_C_DLL)
 endif()
@@ -118,7 +118,7 @@ if (MSVC)
     list(APPEND CMAKE_REQUIRED_FLAGS /wd4996)
 endif()
 
-if (NOT DISABLE_STATIC_FPIC AND NOT AMIGA)
+if (NOT DISABLE_STATIC_FPIC)
     # Use '-fPIC'/'-fPIE' option.
     # This will allow other libraries to statically link in libjson-c.a
     # which in turn prevents crashes in downstream apps that may use
@@ -143,9 +143,7 @@ check_include_file(sys/resource.h   HAVE_SYS_RESOURCE_H) # for getrusage
 check_include_file("dlfcn.h"        HAVE_DLFCN_H)
 check_include_file("endian.h"       HAVE_ENDIAN_H)
 check_include_file("limits.h"       HAVE_LIMITS_H)
-if (NOT AMIGA_M68K)
-    check_include_file("locale.h"       HAVE_LOCALE_H)
-endif()
+check_include_file("locale.h"       HAVE_LOCALE_H)
 check_include_file("memory.h"       HAVE_MEMORY_H)
 
 check_include_file(stdint.h         HAVE_STDINT_H)
index f4a889c074c762d7a3c625f18546130737062bed..1327f3a54341b58a042639366e5c6cd437930b43 100644 (file)
--- a/README.md
+++ b/README.md
@@ -282,34 +282,34 @@ Install Docker on your machine if you don't already have it. You can download Do
 ### To build for Motorola 68k Amiga:
 
 ```
-mkdir json-c-build
+mkdir build
 docker run --rm \
     -v ${PWD}:/work \
     -e USER=$( id -u ) -e GROUP=$( id -g ) \
     -it  sacredbanana/amiga-compiler:m68k-amigaos bash
-cd json-c-build
+cd build
 cmake -DM68K_CRT=newlib ..
 make
 ```
 
-libjson-c.a will get created in the json-c-build directory.
+libjson-c.a will get created in the build directory.
 
 You can change newlib to nix20, nix13 or clib2 if you would like to build the library suited for libnix or clib2 instead. Newlib is default.
 
 ### To build for PowerPC Amiga:
 
 ```
-mkdir json-c-build
+mkdir build
 docker run --rm \
     -v ${PWD}:/work \
     -e USER=$( id -u ) -e GROUP=$( id -g ) \
     -it  sacredbanana/amiga-compiler:ppc-amigaos bash
-cd json-c-build
+cd build
 cmake ..
 make
 ```
 
-libjson-c.a will get created in the json-c-build directory.
+libjson-c.a will get created in the build directory.
 
 <a name="linking"></a>
 Linking to `libjson-c`