about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-07 03:05:54 -0400
committerCharadon <dev@iotib.net>2022-06-07 03:05:54 -0400
commit8a44e0f5d5d9d11fd6b7bc4a5346c5e9b17db739 (patch)
tree8f7069ce77de02396f337c68b628fa69ffef962e
parente1d99fb48bc66150d58ef528eb0594c9df07b572 (diff)
downloadPong-C-8a44e0f5d5d9d11fd6b7bc4a5346c5e9b17db739.tar.gz
Did some stuff with flatpak
-rw-r--r--net.iotib.Pong.yml16
-rw-r--r--premake5.lua35
-rwxr-xr-xsrc/flatpak_launch.sh4
3 files changed, 39 insertions, 16 deletions
diff --git a/net.iotib.Pong.yml b/net.iotib.Pong.yml
index 7a6e81d..e974935 100644
--- a/net.iotib.Pong.yml
+++ b/net.iotib.Pong.yml
@@ -9,13 +9,18 @@ modules:
   - name: Pong
     buildsystem: simple
     build-commands:
-      - make -C raylib/src clean
-      - make -C raylib/src
-      - make
       - mkdir -pv /app/Pong
       - mkdir -pv /app/bin
+      - mkdir -pv /app
+      - mkdir -pv /app/lib
+      - mkdir -pv /app/include
+      - tar -xvf src/flatpak/raylib-4.0.0.tar.gz
+      - make -C raylib-4.0.0/src USE_EXTERNAL_GLFW=FALSE RAYLIB_LIBTYPE=SHARED ROOT=root DESTDIR=/app
+      - sed -i '/ldconfig/d' raylib-4.0.0/src/Makefile
+      - make -C raylib-4.0.0/src USE_EXTERNAL_GLFW=FALSE RAYLIB_LIBTYPE=SHARED ROOT=root DESTDIR=/app install
+      - make
       - install -Dvm755 bin/*/Pong /app/Pong/pong
-      - install -Dvm755 src/flatpak_launch.sh /app/bin/flatpak_launch.sh
+      - install -Dvm755 src/flatpak/flatpak_launch.sh /app/bin/flatpak_launch.sh
       - cp -rv resources /app/Pong/
     sources:
       - type: file
@@ -28,9 +33,6 @@ modules:
       - type: dir
         path: resources
         dest: resources
-      - type: dir
-        path: raylib
-        dest: raylib
 finish-args:
   - --socket=x11
   - --device=dri
diff --git a/premake5.lua b/premake5.lua
index 310499f..be84cff 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -29,6 +29,24 @@ project("Pong")
             os.exit(0)
         end
     }
+
+    newaction {
+        trigger = "check_deps",
+        description = "Check if you have all the dependencies installed.",
+        execute = function()
+            os.executef("rm -rvf %s/obj", _MAIN_SCRIPT_DIR)
+            os.executef("rm -rvf %s/bin", _MAIN_SCRIPT_DIR)
+            os.executef("rm -rvf %s/app", _MAIN_SCRIPT_DIR)
+            os.executef("rm -vf %s/Makefile", _MAIN_SCRIPT_DIR)
+            os.executef("rm -vf %s/Pong.make", _MAIN_SCRIPT_DIR)
+            os.executef("rm -rvf %s/flatpak_repo", _MAIN_SCRIPT_DIR)
+            os.executef("rm -rvf %s/.flatpak-builder", _MAIN_SCRIPT_DIR)
+            os.executef("rm -rvf %s/build-dir", _MAIN_SCRIPT_DIR)
+            os.executef("rm -vf %s/*.flatpak", _MAIN_SCRIPT_DIR)
+            os.exit(0)
+        end
+    }
+
     kind("WindowedApp")
     language("C")
     files {"src/*.c", "src/*.h", }
@@ -50,13 +68,20 @@ project("Pong")
     }
     flatpak = _OPTIONS["flatpak"] or "false"
 
-    -- Find raylib
-    RaylibStaticLibrary = os.findlib("libraylib.a", {"raylib", "raylib/src"})
-    if(RaylibStaticLibrary == nil) then
+    -- Check for pkgconf
+    Pkgconf_Result = os.executef("pkgconf --version")
+    if(Pkgconf_Result == nil)
+    then
+        print("You do not have pkgconf installed. Aborting.")
         os.exit(1)
     end
-    libdirs {RaylibStaticLibrary}
-    linkoptions {"`pkgconf --libs glfw3`", "`pkgconf --libs gl`"}
+
+    if (flatpak == true)
+    then
+        linkoptions {"-L/app/lib"}
+    end
+
+    linkoptions {"-lraylib", "`pkgconf --libs glfw3`", "`pkgconf --libs gl`", "`pkgconf --libs sdl2`", "`pkgconf --libs SDL2_mixer`"}
 
     -- Detect OS
     if(os.ishost("linux") == true) then
diff --git a/src/flatpak_launch.sh b/src/flatpak_launch.sh
deleted file mode 100755
index 1312ef3..0000000
--- a/src/flatpak_launch.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# This file is only for flatpak.
-DIRECTORY="$(dirname $0)"
-cd $DIRECTORY/../Pong && ./pong $@
\ No newline at end of file