Skip to content

Commit

Permalink
Messing around with flatpak.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpoike committed Apr 17, 2023
1 parent 73bb996 commit eaf5967
Show file tree
Hide file tree
Showing 16 changed files with 299 additions and 66 deletions.
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ SET(FTE_BUILD_CONFIG ${CMAKE_HOME_DIRECTORY}/engine/common/config_fteqw.h CACHE
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};CONFIG_FILE_NAME=${FTE_BUILD_CONFIG})
SET(FTE_USE_SDL false CACHE BOOL "Force the use of SDL instead of using native builds.")

INCLUDE(GNUInstallDirs)
SET(FTE_INSTALL_BINDIR games CACHE STRING "Binary dir to install to.")
SET(FTE_INSTALL_LIBDIR fteqw CACHE STRING "Binary dir to install to.")

IF(NOT WIN32)
SET(SYS_LIBS ${SYS_LIBS} m)
ELSE()
Expand Down Expand Up @@ -221,11 +225,13 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug")
ENDIF()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFTE_LIBRARY_PATH=${CMAKE_INSTALL_FULL_LIBDIR}/${FTE_INSTALL_LIBDIR}")

FUNCTION(EMBED_PLUGIN_META PLUGNAME PLUGTITLE PLUGDESC)
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES OUTPUT_NAME "${PLUGNAME}")
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
SET(INSTALLTARGS ${INSTALLTARGS} "plug_${PLUGNAME}")
SET(INSTALLTARGS ${INSTALLTARGS} "plug_${PLUGNAME}" PARENT_SCOPE)
#sadly we need to use a temp zip file, because otherwise zip insists on using zip64 extensions which breaks zip -A (as well as any attempts to read any files).
ADD_CUSTOM_COMMAND(
TARGET plug_${PLUGNAME} POST_BUILD
Expand Down Expand Up @@ -1247,11 +1253,7 @@ IF(FTE_PLUG_NAMEMAKER)
plugins/namemaker/namemaker.c
)
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES OUTPUT_NAME "namemaker")
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_namemaker ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} plug_namemaker)

EMBED_PLUGIN_META(namemaker "Name Maker Plugin" "Provides a lame UI for selecting arbitrary non-ascii glyphs as part of your nickname.")
ENDIF()
Expand Down Expand Up @@ -1531,13 +1533,16 @@ IF(FTE_PLUG_XMPP)
ENDIF()
ENDIF() #android

INCLUDE(GNUInstallDirs)
SET(FTE_INSTALL_BINDIR games CACHE STRING "Binary dir to install to.")
INSTALL(TARGETS ${INSTALLTARGS}
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/${FTE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/${FTE_INSTALL_LIBDIR}"
)

INSTALL(FILES
fteqw.desktop
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications/")


SET(FTE_MENU_SYS true CACHE BOOL "Compile System Menu.")
IF(FTE_MENU_SYS)
ADD_CUSTOM_TARGET(menusys ALL
Expand Down
11 changes: 7 additions & 4 deletions engine/client/cl_ignore.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,13 @@ static void Ignoreteam_f(void)
}
if (j == MAX_TEAMIGNORELIST)
Con_Printf("You cannot ignore more than %d teams\n", MAX_TEAMIGNORELIST);
Q_strncpyz(ignoreteamlist[j], arg, sizeof(ignoreteamlist[j]));
if (j + 1 < MAX_TEAMIGNORELIST)
ignoreteamlist[j + 1][0] = 0;
Con_Printf("Added team %s to ignore list\n", arg);
else
{
Q_strncpyz(ignoreteamlist[j], arg, sizeof(ignoreteamlist[j]));
if (j + 1 < MAX_TEAMIGNORELIST)
ignoreteamlist[j + 1][0] = 0;
Con_Printf("Added team %s to ignore list\n", arg);
}
return;
}
}
Expand Down
6 changes: 4 additions & 2 deletions engine/client/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -4633,8 +4633,10 @@ static void *ReadEXRFile(qbyte *buf, size_t len, const char *fname, int *outwidt
fd = mkstemp(tname); //bsd4.3/posix1-2001
if (fd >= 0)
{
write(fd, buf, len);
ctx = exr.OpenInputFile(tname);
if (write(fd, buf, len) == len)
ctx = exr.OpenInputFile(tname);
else
ctx = NULL;
close(fd); //we don't need the input file now.
unlink(tname);
#endif
Expand Down
13 changes: 10 additions & 3 deletions engine/client/m_download.c
Original file line number Diff line number Diff line change
Expand Up @@ -2075,9 +2075,16 @@ static void PM_PreparePackageList(void)
#ifdef PLUGINS
{
char nat[MAX_OSPATH];
FS_NativePath("", FS_BINARYPATH, nat, sizeof(nat));
Con_DPrintf("Loading plugins from \"%s\"\n", nat);
Sys_EnumerateFiles(nat, PLUGINPREFIX"*" ARCH_DL_POSTFIX, PM_EnumeratedPlugin, &pluginsadded, NULL);
if (FS_NativePath("", FS_BINARYPATH, nat, sizeof(nat)))
{
Con_DPrintf("Loading plugins from \"%s\"\n", nat);
Sys_EnumerateFiles(nat, PLUGINPREFIX"*" ARCH_DL_POSTFIX, PM_EnumeratedPlugin, &pluginsadded, NULL);
}
if (FS_NativePath("", FS_LIBRARYPATH, nat, sizeof(nat)))
{
Con_DPrintf("Loading plugins from \"%s\"\n", nat);
Sys_EnumerateFiles(nat, PLUGINPREFIX"*" ARCH_DL_POSTFIX, PM_EnumeratedPlugin, &pluginsadded, NULL);
}
}
#endif
}
Expand Down
3 changes: 2 additions & 1 deletion engine/client/m_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -4445,7 +4445,8 @@ void M_Menu_Mods_f (void)
MC_AddFrameStart(menu, 32);
for (i = 0; i<1 || Mods_GetMod(i); i++)
{
c = MC_AddCustom(menu, 64, 32+i*8, menu->data, i, NULL);
struct modlist_s *mod = Mods_GetMod(i);
c = MC_AddCustom(menu, 64, 32+i*8, menu->data, i, (mod&&mod->manifest)?mod->manifest->basedir:NULL);
// if (!menu->selecteditem)
// menu->selecteditem = (menuoption_t*)c;
c->common.height = 8;
Expand Down
6 changes: 3 additions & 3 deletions engine/client/sys_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ static int Sys_EnumerateFiles2 (const char *truepath, int apathofs, const char *
{
Q_snprintfz(file, sizeof(file), "%s/%s", truepath, ent->d_name);

if (stat(file, &st) == 0)
if (stat(file, &st) == 0 || lstat(file, &st) == 0)
{
Q_snprintfz(file, sizeof(file), "%s%s%s", apath, ent->d_name, S_ISDIR(st.st_mode)?"/":"");

Expand All @@ -740,8 +740,8 @@ static int Sys_EnumerateFiles2 (const char *truepath, int apathofs, const char *
return false;
}
}
else
printf("Stat failed for \"%s\"\n", file);
// else
// printf("Stat failed for \"%s\"\n", file);
}
}
} while(1);
Expand Down
6 changes: 2 additions & 4 deletions engine/common/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,9 +1190,8 @@ static void Cmd_Alias_f (void)
// check for overlap with a command
if (Cmd_Exists (s))
{ //commands always take precedence over aliases (so mods can't clobber 'quit' etc), so creating an alias with one of these names is stupid. always try to rename them.
if (Cmd_IsInsecure())
if (Cmd_IsInsecure() && snprintf(cmd, sizeof(cmd), "%s_a", s) < sizeof(cmd))
{
snprintf(cmd, sizeof(cmd), "%s_a", s);
if (Cmd_Exists (cmd))
{
Con_Printf (S_COLOR_RED"Can't register alias, %s is a command\n", s);
Expand All @@ -1211,9 +1210,8 @@ static void Cmd_Alias_f (void)
{ //aliases take precedence over cvars (while cvars can be set via 'set'), so user's choice.
if (Cvar_FindVar (s))
{
if (Cmd_IsInsecure())
if (Cmd_IsInsecure() && snprintf(cmd, sizeof(cmd), "%s_a", s) < sizeof(cmd))
{
snprintf(cmd, sizeof(cmd), "%s_a", s);
Con_Printf (S_COLOR_RED"alias %s: renamed to %s due to cvar conflict\n", s, cmd);
s = cmd;
}
Expand Down
Loading

0 comments on commit eaf5967

Please sign in to comment.