Skip to content

Commit 336b563

Browse files
committedOct 19, 2021
updated build config
1 parent 47866a2 commit 336b563

File tree

7 files changed

+55
-7
lines changed

7 files changed

+55
-7
lines changed
 

‎.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ jobs:
8484
name: Release ${{ steps.tagName.outputs.tag }}
8585
prerelease: true
8686
allowUpdates: true
87-
artifacts: "*.ipk"
87+
artifacts: "*.ipk,webosbrew.manifest.json"

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,5 @@ DebugWinXp/
278278
ReleaseWinXp/
279279

280280
# webOS stuff
281-
/*.ipk
281+
/*.ipk
282+
/webosbrew.manifest.json

‎CMakeLists.txt

+7-4
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ set(SOURCE_FILES
175175
# On Windows, include resource file with the icon
176176
if(WIN32)
177177
set_source_files_properties(SpaceCadetPinball/SpaceCadetPinball.rc LANGUAGE RC)
178-
list(APPEND SOURCE_FILES SpaceCadetPinball/SpaceCadetPinball.rc)
178+
list(APPEND SOURCE_FILES SpaceCadetPinball/SpaceCadetPinball.rc)
179179
endif(WIN32)
180180

181181
add_executable(SpaceCadetPinball ${SOURCE_FILES})
@@ -211,7 +211,7 @@ if(WIN32)
211211
string(REGEX REPLACE "lib$" "bin" SDL2_DLL_PATH ${SDL2_DLL_PATH})
212212
string(REGEX REPLACE "lib$" "bin" SDL2_MIXER_DLL_PATH ${SDL2_MIXER_DLL_PATH})
213213
endif()
214-
message(STATUS "copy paths='${SDL2_DLL_PATH}' '${SDL2_MIXER_DLL_PATH}'")
214+
message(STATUS "copy paths='${SDL2_DLL_PATH}' '${SDL2_MIXER_DLL_PATH}'")
215215
add_custom_command(TARGET SpaceCadetPinball POST_BUILD
216216
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_DLL_PATH}/SDL2.dll" $<TARGET_FILE_DIR:SpaceCadetPinball>
217217
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_MIXER_DLL_PATH}/SDL2_mixer.dll" $<TARGET_FILE_DIR:SpaceCadetPinball>
@@ -224,10 +224,13 @@ if(WEBOS)
224224
COMMAND wget -q -N https://archive.org/download/pinballxp/PinballXP.zip -O ${CMAKE_BINARY_DIR}/pinball.zip
225225
COMMAND unzip -o ${CMAKE_BINARY_DIR}/pinball.zip -d $<TARGET_FILE_DIR:SpaceCadetPinball>
226226
COMMAND OUTPUT_FILE=$<TARGET_FILE_DIR:SpaceCadetPinball>/gamecontrollerdb.txt sh webos/gen_gamecontrollerdb.sh
227-
COMMAND convert SpaceCadetPinball/Icon_1.ico[6] -alpha on -background none -gravity center -extent 80x80 $<TARGET_FILE_DIR:SpaceCadetPinball>/icon.png
228-
COMMAND convert SpaceCadetPinball/splash_bitmap.bmp -background black -gravity center -extent 640x480 $<TARGET_FILE_DIR:SpaceCadetPinball>/splash.png
227+
COMMAND ${CMAKE_COMMAND} -E copy_if_different webos/icon.png $<TARGET_FILE_DIR:SpaceCadetPinball>
228+
COMMAND ${CMAKE_COMMAND} -E copy_if_different webos/splash.png $<TARGET_FILE_DIR:SpaceCadetPinball>
229229
COMMAND ${CMAKE_COMMAND} -E copy_if_different webos/appinfo.json $<TARGET_FILE_DIR:SpaceCadetPinball>
230230
COMMAND ares-package $<TARGET_FILE_DIR:SpaceCadetPinball>
231+
# Force PATH environment variable to use system python
232+
COMMAND PATH=/bin:/usr/bin python3 webos/gen_manifest.py -a $<TARGET_FILE_DIR:SpaceCadetPinball>/appinfo.json
233+
-p *.ipk -o webosbrew.manifest.json
231234
DEPENDS SpaceCadetPinball
232235
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
233236
)

‎webos/appinfo.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "com.github.k4zmu2a.space-cadet-pinball",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"vendor": "webOS Brew Project",
55
"type": "native",
66
"main": "SpaceCadetPinball",

‎webos/gen_manifest.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python3
2+
import argparse
3+
import hashlib
4+
import json
5+
from os import path
6+
7+
parser = argparse.ArgumentParser()
8+
parser.add_argument('-a', '--appinfo', required=True)
9+
parser.add_argument('-p', '--pkgfile', required=True)
10+
parser.add_argument('-o', '--output', required=True)
11+
12+
args = parser.parse_args()
13+
14+
outfile = args.output
15+
16+
with open(args.appinfo) as f:
17+
appinfo = json.load(f)
18+
19+
with open(args.pkgfile, 'rb') as f:
20+
hasher = hashlib.new('sha256')
21+
seglen = hasher.block_size * 0x800
22+
segment = f.read(seglen)
23+
while segment:
24+
hasher.update(segment)
25+
segment = f.read(seglen)
26+
27+
pkghash = hasher.hexdigest()
28+
pkgfile = path.basename(args.pkgfile)
29+
30+
with open(outfile, 'w') as f:
31+
json.dump({
32+
'id': appinfo['id'],
33+
'version': appinfo['version'],
34+
'type': appinfo['type'],
35+
'title': appinfo['title'],
36+
'appDescription': appinfo['appDescription'],
37+
'iconUri': 'https://github.com/webosbrew/SpaceCadetPinball/raw/webos/webos/icon.png',
38+
'sourceUrl': 'https://github.com/webosbrew/SpaceCadetPinball',
39+
'rootRequired': False,
40+
'ipkUrl': pkgfile,
41+
'ipkHash': {
42+
'sha256': pkghash
43+
}
44+
}, f)

‎webos/icon.png

5.46 KB
Loading

‎webos/splash.png

30.4 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.