Skip to content

Commit c4f8409

Browse files
ToKe79LibretroAdmin
authored andcommitted
Lakka: provide update URL and target name at buildtime
it is more convenient to provide the URL via make option rather than rely on hardcoded value in the code base. it provides more flexibility in case of different servers for stable, daily, canary, community, ... and instead of parsing a file in the filesystem to obtain target name of the device on which lakka is running, we can provide the target name at build time as well. the target name is used for the full path URL for the download of updates. there is no need to have these values editable via retroarch frontend and saved in the config file. it is safer to provide them at build time and have them set this way.
1 parent 5db932d commit c4f8409

3 files changed

Lines changed: 25 additions & 47 deletions

File tree

Makefile.common

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,24 +1056,22 @@ endif
10561056

10571057
ifeq ($(HAVE_LAKKA), 1)
10581058
DEFINES += -DHAVE_LAKKA
1059+
ifneq ($(HAVE_LAKKA_PROJECT),)
1060+
DEFINES += -DHAVE_LAKKA_PROJECT=\"${HAVE_LAKKA_PROJECT}\"
1061+
else
1062+
$(error You asked for Lakka, but you did not specify a target device name in HAVE_LAKKA_PROJECT)
1063+
endif
1064+
ifneq ($(HAVE_LAKKA_SERVER),)
1065+
DEFINES += -DHAVE_LAKKA_SERVER=\"${HAVE_LAKKA_SERVER}\"
1066+
else
1067+
$(error You asked for Lakka, but you did not specify update server in HAVE_LAKKA_SERVER)
1068+
endif
10591069
endif
10601070

10611071
ifeq ($(HAVE_LAKKA_SWITCH), 1)
10621072
DEFINES += -DHAVE_LAKKA_SWITCH
10631073
endif
10641074

1065-
ifeq ($(HAVE_LAKKA_NIGHTLY), 1)
1066-
DEFINES += -DHAVE_LAKKA_NIGHTLY
1067-
endif
1068-
1069-
ifneq ($(HAVE_LAKKA_CANARY),)
1070-
DEFINES += -DHAVE_LAKKA_CANARY=\"${HAVE_LAKKA_CANARY}\"
1071-
endif
1072-
1073-
ifeq ($(HAVE_LAKKA_DEVBUILD), 1)
1074-
DEFINES += -DHAVE_LAKKA_DEVBUILD
1075-
endif
1076-
10771075
ifeq ($(HAVE_MENU_COMMON), 1)
10781076
OBJ += menu/menu_setting.o \
10791077
menu/menu_driver.o \

file_path_special.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,6 @@ RETRO_BEGIN_DECLS
7676
#define FILE_PATH_LOBBY_LIBRETRO_URL "http://lobby.libretro.com/"
7777
#define FILE_PATH_CORE_THUMBNAILS_URL "http://thumbnails.libretro.com"
7878
#define FILE_PATH_CORE_THUMBNAILPACKS_URL "http://thumbnailpacks.libretro.com"
79-
#ifdef HAVE_LAKKA_CANARY
80-
#define FILE_PATH_LAKKA_URL HAVE_LAKKA_CANARY
81-
#elif defined (HAVE_LAKKA_NIGHTLY)
82-
#define FILE_PATH_LAKKA_URL "http://nightly.builds.lakka.tv/.updater"
83-
#elif defined (HAVE_LAKKA_DEVBUILD)
84-
#define FILE_PATH_LAKKA_URL "http://nightly.builds.lakka.tv/.devbuild"
85-
#else
86-
#define FILE_PATH_LAKKA_URL "http://le.builds.lakka.tv"
87-
#endif
8879
#define FILE_PATH_SHADERS_GLSL_ZIP "shaders_glsl.zip"
8980
#define FILE_PATH_SHADERS_SLANG_ZIP "shaders_slang.zip"
9081
#define FILE_PATH_SHADERS_CG_ZIP "shaders_cg.zip"
@@ -121,6 +112,19 @@ RETRO_BEGIN_DECLS
121112
#define FILE_PATH_CORE_INFO_CACHE "core_info.cache"
122113
#define FILE_PATH_CORE_INFO_CACHE_REFRESH "core_info.refresh"
123114

115+
#ifdef HAVE_LAKKA
116+
#ifdef HAVE_LAKKA_SERVER
117+
#define FILE_PATH_LAKKA_URL HAVE_LAKKA_SERVER
118+
#else
119+
#error "Building for Lakka, but no update server was defined! Add -DHAVE_LAKKA_SERVER=\\\"http://...\\\""
120+
#endif
121+
#ifdef HAVE_LAKKA_PROJECT
122+
#define LAKKA_PROJECT HAVE_LAKKA_PROJECT
123+
#else
124+
#error "Building for Lakka, but no target device name was defined! Add -DHAVE_LAKKA_PROJECT=\\\"DeviceName.arch\\\""
125+
#endif
126+
#endif
127+
124128
enum application_special_type
125129
{
126130
APPLICATION_SPECIAL_NONE = 0,

menu/cbs/menu_cbs_ok.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -246,30 +246,6 @@ static int (funcname)(const char *path, const char *label, unsigned type, size_t
246246
return generic_action_ok_help(path, label, type, idx, entry_idx, _id, _id2); \
247247
}
248248

249-
#ifdef HAVE_NETWORKING
250-
#ifdef HAVE_LAKKA
251-
static char *lakka_get_project(void)
252-
{
253-
#ifndef HAVE_LAKKA_CANARY
254-
size_t len;
255-
static char lakka_project[128];
256-
FILE *command_file = popen("cat /etc/release | cut -d - -f 1", "r");
257-
258-
fgets(lakka_project, sizeof(lakka_project), command_file);
259-
len = strlen(lakka_project);
260-
261-
if (len > 0 && lakka_project[len-1] == '\n')
262-
lakka_project[--len] = '\0';
263-
264-
pclose(command_file);
265-
return lakka_project;
266-
#else
267-
return "/";
268-
#endif
269-
}
270-
#endif
271-
#endif
272-
273249
static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl)
274250
{
275251
switch (lbl)
@@ -5049,7 +5025,7 @@ static int generic_action_ok_network(const char *path,
50495025
/* TODO unhardcode this path */
50505026
fill_pathname_join_special(url_path,
50515027
FILE_PATH_LAKKA_URL,
5052-
lakka_get_project(), sizeof(url_path));
5028+
LAKKA_PROJECT, sizeof(url_path));
50535029
fill_pathname_join_special(url_path, url_path,
50545030
FILE_PATH_INDEX_URL,
50555031
sizeof(url_path));
@@ -5340,7 +5316,7 @@ static int action_ok_download_generic(const char *path,
53405316
#ifdef HAVE_LAKKA
53415317
/* TODO unhardcode this path*/
53425318
fill_pathname_join_special(s, FILE_PATH_LAKKA_URL,
5343-
lakka_get_project(), sizeof(s));
5319+
LAKKA_PROJECT, sizeof(s));
53445320
#endif
53455321
break;
53465322
case MENU_ENUM_LABEL_CB_UPDATE_ASSETS:

0 commit comments

Comments
 (0)