فهرست منبع

Port build-script from SDL3

[ci skip]
Anonymous Maarten 8 ماه پیش
والد
کامیت
48aa1cccf7
7فایلهای تغییر یافته به همراه692 افزوده شده و 297 حذف شده
  1. 1 1
      .gitignore
  2. 2 2
      CMakeLists.txt
  3. 635 227
      build-scripts/build-release.py
  4. 6 5
      build-scripts/create-release.py
  5. 45 59
      build-scripts/release-info.json
  6. 2 2
      build-scripts/showrev.sh
  7. 1 1
      build-scripts/updaterev.sh

+ 1 - 1
.gitignore

@@ -15,7 +15,7 @@ build
 gen
 gen
 Build
 Build
 buildbot
 buildbot
-/VERSION.txt
+/REVISION.txt
 dist
 dist
 
 
 *.so
 *.so

+ 2 - 2
CMakeLists.txt

@@ -3081,8 +3081,8 @@ endif()
 
 
 # Compat helpers for the configuration files
 # Compat helpers for the configuration files
 
 
-if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION.txt")
-  file(READ "${PROJECT_SOURCE_DIR}/VERSION.txt" SDL_SOURCE_VERSION)
+if(EXISTS "${PROJECT_SOURCE_DIR}/REVISION.txt")
+  file(READ "${PROJECT_SOURCE_DIR}/REVISION.txt" SDL_SOURCE_VERSION)
   string(STRIP "${SDL_SOURCE_VERSION}" SDL_SOURCE_VERSION)
   string(STRIP "${SDL_SOURCE_VERSION}" SDL_SOURCE_VERSION)
 endif()
 endif()
 
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 635 - 227
build-scripts/build-release.py


+ 6 - 5
build-scripts/create-release.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 
 import argparse
 import argparse
 from pathlib import Path
 from pathlib import Path
@@ -10,17 +10,18 @@ import subprocess
 ROOT = Path(__file__).resolve().parents[1]
 ROOT = Path(__file__).resolve().parents[1]
 
 
 
 
-def determine_project() -> str:
+def determine_remote() -> str:
     text = (ROOT / "build-scripts/release-info.json").read_text()
     text = (ROOT / "build-scripts/release-info.json").read_text()
     release_info = json.loads(text)
     release_info = json.loads(text)
+    if "remote" in release_info:
+        return release_info["remote"]
     project_with_version = release_info["name"]
     project_with_version = release_info["name"]
     project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
     project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
-    return project
+    return f"libsdl-org/{project}"
 
 
 
 
 def main():
 def main():
-    project = determine_project()
-    default_remote = f"libsdl-org/{project}"
+    default_remote = determine_remote()
 
 
     current_commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip()
     current_commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip()
 
 

+ 45 - 59
build-scripts/release-info.json

@@ -1,5 +1,6 @@
 {
 {
   "name": "SDL2",
   "name": "SDL2",
+  "remote": "libsdl-org/SDL",
   "version": {
   "version": {
     "file": "include/SDL_version.h",
     "file": "include/SDL_version.h",
     "re_major": "^#define SDL_MAJOR_VERSION\\s+([0-9]+)$",
     "re_major": "^#define SDL_MAJOR_VERSION\\s+([0-9]+)$",
@@ -23,10 +24,15 @@
     "autotools": {
     "autotools": {
       "archs": ["x86", "x64"],
       "archs": ["x86", "x64"],
       "args": [
       "args": [
-      ]
+      ],
+      "files": {
+        "@<@TRIPLET@>@/include/SDL2": [
+          "include/SDL_config*.h"
+        ]
+      }
     },
     },
     "files": {
     "files": {
-      "/": [
+      "": [
         "mingw/pkg-support/INSTALL.txt",
         "mingw/pkg-support/INSTALL.txt",
         "mingw/pkg-support/Makefile",
         "mingw/pkg-support/Makefile",
         "BUGS.txt",
         "BUGS.txt",
@@ -36,15 +42,12 @@
         "LICENSE.txt",
         "LICENSE.txt",
         "README.md"
         "README.md"
       ],
       ],
-      "/cmake/": [
+      "cmake": [
         "mingw/pkg-support/cmake/sdl2-config.cmake",
         "mingw/pkg-support/cmake/sdl2-config.cmake",
         "mingw/pkg-support/cmake/sdl2-config-version.cmake"
         "mingw/pkg-support/cmake/sdl2-config-version.cmake"
       ],
       ],
-      "/docs/": [
+      "docs": [
         "docs/*"
         "docs/*"
-      ],
-      "/@TRIPLET@/include/SDL2/": [
-        "include/SDL_config*.h"
       ]
       ]
     }
     }
   },
   },
@@ -59,61 +62,44 @@
         "VisualC/SDLmain/SDLmain.vcxproj",
         "VisualC/SDLmain/SDLmain.vcxproj",
         "VisualC/SDLtest/SDLtest.vcxproj"
         "VisualC/SDLtest/SDLtest.vcxproj"
       ],
       ],
-      "files": [
-        {
-          "lib": "",
-          "devel": "lib/@ARCH@",
-          "paths": [
-            "VisualC/SDL/@PLATFORM@/@CONFIGURATION@/SDL2.dll"
-          ]
-        },
-        {
-          "devel": "lib/@ARCH@",
-          "paths": [
-            "VisualC/SDL/@PLATFORM@/@CONFIGURATION@/SDL2.lib",
-            "VisualC/SDL/@PLATFORM@/@CONFIGURATION@/SDL2.pdb",
-            "VisualC/SDLmain/@PLATFORM@/@CONFIGURATION@/SDL2main.lib",
-            "VisualC/SDLtest/@PLATFORM@/@CONFIGURATION@/SDL2test.lib"
-          ]
-        }
-      ]
-    },
-    "files": [
-      {
-        "devel": "",
-        "lib": "",
-        "paths": [
-          "README-SDL.txt"
-        ]
-      },
-      {
-        "devel": "",
-        "paths": [
-          "BUGS.txt",
-          "LICENSE.txt",
-          "README.md",
-          "WhatsNew.txt"
-        ]
-      },
-      {
-        "devel": "cmake",
-        "paths": [
-          "VisualC/pkg-support/cmake/sdl2-config.cmake",
-          "VisualC/pkg-support/cmake/sdl2-config-version.cmake"
-        ]
-      },
-      {
-        "devel": "docs",
-        "paths": [
-          "docs/*"
+      "files-lib": {
+        "": [
+          "VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2.dll"
         ]
         ]
       },
       },
-      {
-        "devel": "include",
-        "paths": [
-          "include/*.h"
+      "files-devel": {
+        "lib/@<@ARCH@>@": [
+          "VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2.dll",
+          "VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2.lib",
+          "VisualC/SDL/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2.pdb",
+          "VisualC/SDLmain/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2main.lib",
+          "VisualC/SDLtest/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2test.lib"
         ]
         ]
       }
       }
-    ]
+    },
+    "files-lib": {
+      "": [
+        "README-SDL.txt"
+      ]
+    },
+    "files-devel": {
+      "": [
+        "README-SDL.txt",
+        "BUGS.txt",
+        "LICENSE.txt",
+        "README.md",
+        "WhatsNew.txt"
+      ],
+      "cmake": [
+        "VisualC/pkg-support/cmake/sdl2-config.cmake",
+        "VisualC/pkg-support/cmake/sdl2-config-version.cmake"
+      ],
+      "docs": [
+        "docs/*"
+      ],
+      "include": [
+        "include/*.h"
+      ]
+    }
   }
   }
 }
 }

+ 2 - 2
build-scripts/showrev.sh

@@ -5,8 +5,8 @@
 SDL_ROOT=$(dirname $0)/..
 SDL_ROOT=$(dirname $0)/..
 cd $SDL_ROOT
 cd $SDL_ROOT
 
 
-if [ -e ./VERSION.txt ]; then
-    cat ./VERSION.txt
+if [ -e ./REVISION.txt ]; then
+    cat ./REVISION.txt
     exit 0
     exit 0
 fi
 fi
 
 

+ 1 - 1
build-scripts/updaterev.sh

@@ -29,7 +29,7 @@ done
 rev=`sh showrev.sh 2>/dev/null`
 rev=`sh showrev.sh 2>/dev/null`
 if [ "$rev" != "" ]; then
 if [ "$rev" != "" ]; then
     if [ -n "$dist" ]; then
     if [ -n "$dist" ]; then
-        echo "$rev" > "$outdir/VERSION.txt"
+        echo "$rev" > "$outdir/REVISION.txt"
     fi
     fi
     echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
     echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
     if [ -n "$vendor" ]; then
     if [ -n "$vendor" ]; then

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است