Skip to content

Commit eaf5967

Browse files
committed
Messing around with flatpak.
1 parent 73bb996 commit eaf5967

16 files changed

+299
-66
lines changed

CMakeLists.txt

+13-8
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ SET(FTE_BUILD_CONFIG ${CMAKE_HOME_DIRECTORY}/engine/common/config_fteqw.h CACHE
9595
SET(FTE_LIB_DEFINES ${FTE_LIB_DEFINES};CONFIG_FILE_NAME=${FTE_BUILD_CONFIG})
9696
SET(FTE_USE_SDL false CACHE BOOL "Force the use of SDL instead of using native builds.")
9797

98+
INCLUDE(GNUInstallDirs)
99+
SET(FTE_INSTALL_BINDIR games CACHE STRING "Binary dir to install to.")
100+
SET(FTE_INSTALL_LIBDIR fteqw CACHE STRING "Binary dir to install to.")
101+
98102
IF(NOT WIN32)
99103
SET(SYS_LIBS ${SYS_LIBS} m)
100104
ELSE()
@@ -221,11 +225,13 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug")
221225
ENDIF()
222226
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
223227

228+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFTE_LIBRARY_PATH=${CMAKE_INSTALL_FULL_LIBDIR}/${FTE_INSTALL_LIBDIR}")
229+
224230
FUNCTION(EMBED_PLUGIN_META PLUGNAME PLUGTITLE PLUGDESC)
225231
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES OUTPUT_NAME "${PLUGNAME}")
226232
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES PREFIX "fteplug_")
227233
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
228-
SET(INSTALLTARGS ${INSTALLTARGS} "plug_${PLUGNAME}")
234+
SET(INSTALLTARGS ${INSTALLTARGS} "plug_${PLUGNAME}" PARENT_SCOPE)
229235
#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).
230236
ADD_CUSTOM_COMMAND(
231237
TARGET plug_${PLUGNAME} POST_BUILD
@@ -1247,11 +1253,7 @@ IF(FTE_PLUG_NAMEMAKER)
12471253
plugins/namemaker/namemaker.c
12481254
)
12491255
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES COMPILE_DEFINITIONS "${FTE_LIB_DEFINES}")
1250-
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES OUTPUT_NAME "namemaker")
1251-
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES PREFIX "fteplug_")
1252-
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
12531256
TARGET_LINK_LIBRARIES(plug_namemaker ${SYS_LIBS})
1254-
SET(INSTALLTARGS ${INSTALLTARGS} plug_namemaker)
12551257

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

1534-
INCLUDE(GNUInstallDirs)
1535-
SET(FTE_INSTALL_BINDIR games CACHE STRING "Binary dir to install to.")
15361536
INSTALL(TARGETS ${INSTALLTARGS}
15371537
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/${FTE_INSTALL_BINDIR}"
1538-
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
1538+
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/${FTE_INSTALL_LIBDIR}"
15391539
)
15401540

1541+
INSTALL(FILES
1542+
fteqw.desktop
1543+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications/")
1544+
1545+
15411546
SET(FTE_MENU_SYS true CACHE BOOL "Compile System Menu.")
15421547
IF(FTE_MENU_SYS)
15431548
ADD_CUSTOM_TARGET(menusys ALL

engine/client/cl_ignore.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,13 @@ static void Ignoreteam_f(void)
460460
}
461461
if (j == MAX_TEAMIGNORELIST)
462462
Con_Printf("You cannot ignore more than %d teams\n", MAX_TEAMIGNORELIST);
463-
Q_strncpyz(ignoreteamlist[j], arg, sizeof(ignoreteamlist[j]));
464-
if (j + 1 < MAX_TEAMIGNORELIST)
465-
ignoreteamlist[j + 1][0] = 0;
466-
Con_Printf("Added team %s to ignore list\n", arg);
463+
else
464+
{
465+
Q_strncpyz(ignoreteamlist[j], arg, sizeof(ignoreteamlist[j]));
466+
if (j + 1 < MAX_TEAMIGNORELIST)
467+
ignoreteamlist[j + 1][0] = 0;
468+
Con_Printf("Added team %s to ignore list\n", arg);
469+
}
467470
return;
468471
}
469472
}

engine/client/image.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -4633,8 +4633,10 @@ static void *ReadEXRFile(qbyte *buf, size_t len, const char *fname, int *outwidt
46334633
fd = mkstemp(tname); //bsd4.3/posix1-2001
46344634
if (fd >= 0)
46354635
{
4636-
write(fd, buf, len);
4637-
ctx = exr.OpenInputFile(tname);
4636+
if (write(fd, buf, len) == len)
4637+
ctx = exr.OpenInputFile(tname);
4638+
else
4639+
ctx = NULL;
46384640
close(fd); //we don't need the input file now.
46394641
unlink(tname);
46404642
#endif

engine/client/m_download.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -2075,9 +2075,16 @@ static void PM_PreparePackageList(void)
20752075
#ifdef PLUGINS
20762076
{
20772077
char nat[MAX_OSPATH];
2078-
FS_NativePath("", FS_BINARYPATH, nat, sizeof(nat));
2079-
Con_DPrintf("Loading plugins from \"%s\"\n", nat);
2080-
Sys_EnumerateFiles(nat, PLUGINPREFIX"*" ARCH_DL_POSTFIX, PM_EnumeratedPlugin, &pluginsadded, NULL);
2078+
if (FS_NativePath("", FS_BINARYPATH, nat, sizeof(nat)))
2079+
{
2080+
Con_DPrintf("Loading plugins from \"%s\"\n", nat);
2081+
Sys_EnumerateFiles(nat, PLUGINPREFIX"*" ARCH_DL_POSTFIX, PM_EnumeratedPlugin, &pluginsadded, NULL);
2082+
}
2083+
if (FS_NativePath("", FS_LIBRARYPATH, nat, sizeof(nat)))
2084+
{
2085+
Con_DPrintf("Loading plugins from \"%s\"\n", nat);
2086+
Sys_EnumerateFiles(nat, PLUGINPREFIX"*" ARCH_DL_POSTFIX, PM_EnumeratedPlugin, &pluginsadded, NULL);
2087+
}
20812088
}
20822089
#endif
20832090
}

engine/client/m_options.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -4445,7 +4445,8 @@ void M_Menu_Mods_f (void)
44454445
MC_AddFrameStart(menu, 32);
44464446
for (i = 0; i<1 || Mods_GetMod(i); i++)
44474447
{
4448-
c = MC_AddCustom(menu, 64, 32+i*8, menu->data, i, NULL);
4448+
struct modlist_s *mod = Mods_GetMod(i);
4449+
c = MC_AddCustom(menu, 64, 32+i*8, menu->data, i, (mod&&mod->manifest)?mod->manifest->basedir:NULL);
44494450
// if (!menu->selecteditem)
44504451
// menu->selecteditem = (menuoption_t*)c;
44514452
c->common.height = 8;

engine/client/sys_sdl.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ static int Sys_EnumerateFiles2 (const char *truepath, int apathofs, const char *
729729
{
730730
Q_snprintfz(file, sizeof(file), "%s/%s", truepath, ent->d_name);
731731

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

@@ -740,8 +740,8 @@ static int Sys_EnumerateFiles2 (const char *truepath, int apathofs, const char *
740740
return false;
741741
}
742742
}
743-
else
744-
printf("Stat failed for \"%s\"\n", file);
743+
// else
744+
// printf("Stat failed for \"%s\"\n", file);
745745
}
746746
}
747747
} while(1);

engine/common/cmd.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -1190,9 +1190,8 @@ static void Cmd_Alias_f (void)
11901190
// check for overlap with a command
11911191
if (Cmd_Exists (s))
11921192
{ //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.
1193-
if (Cmd_IsInsecure())
1193+
if (Cmd_IsInsecure() && snprintf(cmd, sizeof(cmd), "%s_a", s) < sizeof(cmd))
11941194
{
1195-
snprintf(cmd, sizeof(cmd), "%s_a", s);
11961195
if (Cmd_Exists (cmd))
11971196
{
11981197
Con_Printf (S_COLOR_RED"Can't register alias, %s is a command\n", s);
@@ -1211,9 +1210,8 @@ static void Cmd_Alias_f (void)
12111210
{ //aliases take precedence over cvars (while cvars can be set via 'set'), so user's choice.
12121211
if (Cvar_FindVar (s))
12131212
{
1214-
if (Cmd_IsInsecure())
1213+
if (Cmd_IsInsecure() && snprintf(cmd, sizeof(cmd), "%s_a", s) < sizeof(cmd))
12151214
{
1216-
snprintf(cmd, sizeof(cmd), "%s_a", s);
12171215
Con_Printf (S_COLOR_RED"alias %s: renamed to %s due to cvar conflict\n", s, cmd);
12181216
s = cmd;
12191217
}

0 commit comments

Comments
 (0)