]> Trent Huber's Code - xpmview.git/commitdiff
Linux portability tested
authorTrent Huber <trentmhuber@gmail.com>
Thu, 17 Apr 2025 07:21:34 +0000 (03:21 -0400)
committerTrent Huber <trentmhuber@gmail.com>
Thu, 17 Apr 2025 07:21:34 +0000 (03:21 -0400)
build.h
external/build.c
external/cbs
src/build.c
src/colors/build.c
src/font/build.c
src/main.c
src/xpm.c

diff --git a/build.h b/build.h
index 4cd39a7dfab00bc28076f421e3d497934005ec85..4e79208312982b43373127206ab9f79105747fbe 100644 (file)
--- a/build.h
+++ b/build.h
@@ -13,7 +13,6 @@
 #define RLHDR RLSRC "raylib"
 #define RLLIB RLROOT "raylib" RLEXT
 
-#define CFGLOBALS "-Wall", "-Wextra", "-Wpedantic"
 #define CFRAYLIB "-I" RLSRC
 #define CFSRC "-I" SRC
 
index b42568d7948ab413ac6f692ccab032f6e47ebfcc..5f44c4e2831c36ed0a5c01ff5e586f664dc66b39 100644 (file)
@@ -7,7 +7,11 @@
    RLSRC "rtextures", RLSRC "utils", \
    RLSRC "rcore", RLSRC "rglfw"
 
-#define CFRLPLAT "-DPLATFORM_DESKTOP"
+#ifdef RLDYNAMIC
+#define CFRLGLOBAL "-DPLATFORM_DESKTOP", "-fPIC"
+#else
+#define CFRLGLOBAL "-DPLATFORM_DESKTOP"
+#endif
 #define CFRLGLFW "-I" RLSRC "external/glfw/include"
 #ifdef __APPLE__
 #define CFRLX "-x", "objective-c"
@@ -30,11 +34,11 @@ int main(void) {
    build(NULL);
 
    src = (char *[]){RLSRCS, NULL};
-   cflags = (char *[]){CFRLPLAT, NULL};
+   cflags = (char *[]){CFRLGLOBAL, NULL};
    for (i = 0; i < 6; ++i) compile(src[i], NULL);
-   cflags = (char *[]){CFRLPLAT, CFRLGLFW, NULL};
+   cflags = (char *[]){CFRLGLOBAL, CFRLGLFW, NULL};
    compile(src[6], NULL);
-   cflags = (char *[]){CFRLPLAT, CFRLGLFW, CFRLX, NULL};
+   cflags = (char *[]){CFRLGLOBAL, CFRLGLFW, CFRLX, NULL};
    compile(src[7], NULL);
 
 #ifdef RLDYNAMIC
index 08b7229355a54a4339931411629bcb9ea48b5926..3f59e2fa436ef5d7e527fd39e52a050536669db7 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 08b7229355a54a4339931411629bcb9ea48b5926
+Subproject commit 3f59e2fa436ef5d7e527fd39e52a050536669db7
index 618ee8e67e105369211533cbe35523d77d587000..c199a03ee7154fbf23fa239272c65fc3195425ad 100644 (file)
 int main(void) {
    build(NULL);
 
-   cflags = (char *[]){CFGLOBALS, NULL};
    compile("error", NULL);
 
    build("colors/");
    build("font/");
 
-   cflags = (char *[]){CFGLOBALS, CFRAYLIB, NULL};
+   cflags = (char *[]){CFRAYLIB, NULL};
    compile("main", "error", RLHDR, "xpm", "font.c", NULL);
-   cflags = (char *[]){CFGLOBALS, NULL};
+   cflags = NULL;
    compile("options", "error", NULL);
-   cflags = (char *[]){CFGLOBALS, CFRAYLIB, CFCBS, NULL};
+   cflags = (char *[]){CFRAYLIB, CFCBS, NULL};
    compile("xpm", "error", RLHDR, "xpm", CBS "cbs.c", "colors.c", NULL);
 
 #ifndef RLDYNAMIC
index 2e5c8b45c7496ab3e52865ee475e9ed820c8da9d..d6fcbfba2b613d61d4a2a055349e7ba0714dc424 100644 (file)
@@ -6,7 +6,7 @@
 int main(void) {
    build(NULL);
 
-   cflags = (char *[]){CFGLOBALS, CFSRC, NULL};
+   cflags = (char *[]){CFSRC, NULL};
    compile("gencolors", SRC "error", NULL);
    load('x', "gencolors", SRC "error", "gencolors", NULL);
 
index ac5e31a1648708f2da7098bce0fe6b5c3ba9173c..87f5e39311d2e732f2abc1e77b82c43e50fe7d12 100644 (file)
@@ -6,7 +6,7 @@
 int main(void) {
    build(NULL);
 
-   cflags = (char *[]){CFGLOBALS, CFRAYLIB, CFSRC, NULL};
+   cflags = (char *[]){CFRAYLIB, CFSRC, NULL};
    compile("genfont", SRC "error", RLHDR, NULL);
 
 #ifndef RLDYNAMIC
index 87f6f2c150c83cbdd5735b756422e4c4cd984299..89d0e93b954ea877d4d46e20375fd7fc2717ae47 100644 (file)
@@ -88,8 +88,8 @@ int main(int argc, char **argv) {
 
        ClearBackground(CLITERAL(Color){0xec, 0xec, 0xec, 0xff});
 
-       width = GetRenderWidth();
-       height = GetRenderHeight();
+       width = GetScreenWidth();
+       height = GetScreenHeight();
        if (texture.id) {
            scale = width * texture.height > height * texture.width
                    ? (float)height / texture.height
index de5a5aef6a797acba27bf91fadd12efac27487c9..01f144e5ddbb2c1cc8415ab6691bb844fb7773d4 100644 (file)
--- a/src/xpm.c
+++ b/src/xpm.c
@@ -125,7 +125,7 @@ static unsigned int str2color(char **strp) {
        return 0;
    }
 
-   if (r > 0xffffff || r < 0) {
+   if (r > 0xffffff) {
        xpmerror("`0x%06x' is not a valid RGB color", r);
        return 0;
    }
@@ -269,21 +269,21 @@ static Image process(char *xpm) {
    }
    if (cpid == -1 || waitpid(cpid, &status, 0) == -1
        || !WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) {
-       xpmerror("Unable to create `/tmp/libxpm.dylib'");
+       xpmerror("Unable to create `/tmp/libxpm" DYEXT "'");
        goto munmap;
    }
 
-   if ((d = dlopen("/tmp/libxpm.dylib", 0)) == NULL) {
-       xpmerror("Unable to load `/tmp/libxpm.dylib': %s", dlerror());
+   if ((d = dlopen("/tmp/libxpm" DYEXT, RTLD_LAZY)) == NULL) {
+       xpmerror("Unable to load `/tmp/libxpm" DYEXT "': %s", dlerror());
        goto munmap;
    }
    if ((data = (char **)dlsym(d, a)) == NULL) {
-       xpmerror("Unable to load image data from `/tmp/libxpm.dylib': `%s'",
+       xpmerror("Unable to load image data from `/tmp/libxpm" DYEXT "': `%s'",
                 dlerror());
        goto dlclose;
    }
    if ((sizep = (long *)dlsym(d, "size")) == NULL) {
-       xpmerror("Unable to load image length from `/tmp/libxpm.dylib': `%s'",
+       xpmerror("Unable to load image length from `/tmp/libxpm" DYEXT "': `%s'",
              dlerror());
        goto dlclose;
    }
@@ -292,7 +292,7 @@ static Image process(char *xpm) {
 
 dlclose:
    if (dlclose(d))
-       xpmerror("Unable to unload `/tmp/libxpm.dylib': %s", dlerror());
+       xpmerror("Unable to unload `/tmp/libxpm" DYEXT "': %s", dlerror());
 
 munmap:
    if (munmap(map, l) == -1) xpmerror("Unable to unmap `%s' from memory", xpm);