diff --git a/Makefile.inc.in b/Makefile.inc.in index 911aa5a65991231ba6b8698e117d3fb9c00a1873..62178ddab1d7ac13e217348e78ce5a39d81e8e0c 100644 --- a/Makefile.inc.in +++ b/Makefile.inc.in @@ -21,6 +21,7 @@ LIB := $(LIB) # PLATFORM SETTINGS ################### BUILD_DARWIN = @build_darwin@ +BUILD_LINUX = @build_linux@ ####### # FLAGS diff --git a/Makefile.target b/Makefile.target index 6156fa8ebc063fd6008e52655c32b06417ddf5a4..d0ad20cbeab342b269175296a093d20cfdeec43e 100644 --- a/Makefile.target +++ b/Makefile.target @@ -1,5 +1,8 @@ ifneq (yes, $(INCLUDING_CHILD_MAKEFILES)) -COMMANDS := all install clean distclean test depclean osx-bundle osx-dmg test-automation test-libaegisub style tags appimage +COMMANDS := all install clean distclean test depclean osx-bundle osx-dmg test-automation test-libaegisub style tags +ifeq (yes, $(BUILD_LINUX)) +COMMANDS := $(COMMANDS) appimage +endif .PHONY: $(COMMANDS) .DEFAULT_GOAL := all @@ -41,10 +44,9 @@ endef $(foreach target,$(LIB),$(eval $(call set_target_flags,$(target),$(TOP)lib/lib$(target).a))) $(foreach target,$(PROGRAM),$(eval $(call set_target_flags,$(notdir $(target)),$(target)))) -# Create the build and install targets for programs -# Not done with a pattern rule since the pattern would be just %: and doing that -# leads to make trying to use gcc to make any nonexistent targets rather than -# erroring +# Create the build and install targets for programs. Not done with a pattern +# rule since the pattern would be just %: and doing that leads to make trying +# to use gcc to make any nonexistent targets rather than erroring define create_program_targets ifdef $1_INSTALLNAME install: $(DESTDIR)$(P_BINDIR)/$($1_INSTALLNAME) @@ -80,6 +82,7 @@ all: $(LIB_TARGETS) clean: $(BIN_RM) -f $(OBJ) $(CLEANFILES) $(LIB_TARGETS) + $(BIN_RM) -rf $(CLEANDIRS) distclean: clean $(BIN_RM) -rf $(DISTCLEANFILES) $(DEP) @@ -90,12 +93,12 @@ depclean: clean install: style: - ./tools/astyle.bash + $(TOP)tools/astyle.bash tags: - ./tools/tags.bash + $(TOP)tools/tags.bash -appimage: src/aegisub packages/desktop/Aegisub.desktop packages/desktop/aegisub.png +appimage: src/aegisub packages/desktop/Aegisub.desktop packages/desktop/aegisub.png install $(TOOL_LINUXDEPLOY) --appdir Aegisub --desktop-file packages/desktop/Aegisub.desktop --icon-file packages/desktop/aegisub.png --executable src/aegisub $(TOOL_APPIMAGE) Aegisub @@ -103,7 +106,7 @@ appimage: src/aegisub packages/desktop/Aegisub.desktop packages/desktop/aegisub. .SUFFIXES: CXX_CMD = $(CXX_ENV) $(BIN_CXX) $(CFLAGS_DEP) $(CPPFLAGS) -CC_CMD = $(CXX_ENV) $(BIN_CC) $(CFLAGS_DEP) $(CPPFLAGS) +CC_CMD = $(CXX_ENV) $(BIN_CC) $(CFLAGS_DEP) $(CPPFLAGS) POST_FLAGS = $($@_FLAGS) -c -o $@ $< %.o: %.c ; $(CC_CMD) $(CFLAGS) $(POST_FLAGS) @@ -119,9 +122,9 @@ POST_FLAGS = $($@_FLAGS) -c -o $@ $< .SECONDEXPANSION: -# Libraries contain all object files they depend on (but they may depend on other files) -# Not using libtool on OS X because it has an unsilenceable warning about a -# compatibility issue with BSD 4.3 (wtf) +# Libraries contain all object files they depend on (but they may depend on +# other files). Not using libtool on OS X because it has an unsilenceable +# warning about a compatibility issue with BSD 4.3 (wtf) lib%.a: $$($$*_OBJ) @$(BIN_MKDIR_P) $(dir $@) $(BIN_AR) cru $@ $(filter %.o,$^) diff --git a/README.md b/README.md index dd9bed9599d73d8964251fd08c9c4f3df49cae12..8632f33e60b197764fd29685e8b5c9d391b1e8b8 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Once all the dependencies are installed, run: ```bash autoreconf -./configure --enable-debug --with-libpulse +./configure --enable-debug --enable-debug-exceptions --with-libpulse --disable-update-checker --enable-silent-rules --without-system-luajit make -j$(nproc) make install ``` @@ -83,31 +83,15 @@ will also need to download the appimagetool binary and save it to the [tools](tools) folder. If you don't do it manually, it will be done for you at some point by the build scripts. -```bash -wget https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage \ - -O tools/appimagetool.AppImage -``` - -Then, build normally aegisub, but with the appimage options: +To build the AppImage, juste use the following commands: ```bash autoreconf -./configure --enable-debug --with-libpulse --enable-appimage +./configure --with-libpulse --enable-silent-rules --disable-update-checker --without-system-luajit --enable-appimage make -j$(nproc) make appimage ``` -The command to build the AppImage is the following and is performed by the -`make appimage`: - -```bash -linuxdeploy \ - --appdir Aegisub \ - --desktop-file packages/desktop/Aegisub.desktop \ - --icon-file packages/desktop/aegisub.png \ - --executable src/aegisub -``` - ### Windows Prerequisites: diff --git a/configure.ac b/configure.ac index a81fdfb0274f759f828297a57281d1615db109cf..649315859f53b0c68240ab86234e378ae7961251 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,7 @@ AS_CASE([$host], [*-*-linux*], [build_linux="yes"]) AC_SUBST(build_darwin) +AC_SUBST(build_linux) ######################## # Configurable variables @@ -75,6 +76,39 @@ AC_SUBST(P_ICON) # set it to $ac_default_prefix if it hasn't been supplied. AS_CASE([x$prefix], [xNONE | x], [prefix="$ac_default_prefix"], []) +# Build with appimage support +# Do this here because we will override the install path +AC_ARG_ENABLE([appimage], + [AS_HELP_STRING([--enable-appimage], [Build Aegisub as an AppImage. Defaults to no])], + [AEGISUB_APPIMAGE_ENABLED=$enableval], + [AEGISUB_APPIMAGE_ENABLED=no]) +AS_IF([test "x$AEGISUB_APPIMAGE_ENABLED" = "xyes"], [ + # Download the AppImage creation tool, transforms the AppDir into an AppImage + AC_MSG_CHECKING([Downloading AppImage creation tool]) + wget https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-`arch`.AppImage -O tools/appimagetool.AppImage -o config.wget.log + chmod 00700 tools/appimagetool.AppImage + AS_IF([test $? -eq 0 ], [ + AC_MSG_RESULT([done]) + ], [ + AC_MSG_FAILURE([failed]) + ]) + + # Downlaod the AppDir management tool, create the AppDir + AC_MSG_CHECKING([Downloading LinuxDeploy creation tool]) + wget https://martinm.iiens.net/linuxdeploy -O tools/linuxdeploy -a config.wget.log + chmod 00700 tools/linuxdeploy + AS_IF([test $? -eq 0 ], [ + AC_MSG_RESULT([done]) + ], [ + AC_MSG_FAILURE([failed]) + ]) + + # Override prefix + prefix="$PWD/Aegisub/usr" +], [ + AC_MSG_NOTICE([Don't build with AppImage support]) +]) + # Install prefix used by wxStandardPaths::SetInstallPrefix. AC_DEFINE_UNQUOTED([INSTALL_PREFIX], ["$prefix"], [Default install prefix, or --prefix.]) @@ -182,37 +216,6 @@ AC_CHECK_HEADERS([sys/time.h]) AC_ARG_ENABLE(sanity-checks, AS_HELP_STRING([--disable-sanity-checks],[Skip verifying that found libraries work.])) -############################# -# Build with appimage support -############################# -AC_ARG_ENABLE([appimage], - [AS_HELP_STRING([--enable-appimage], [Build Aegisub as an AppImage. Defaults to no])], - [AEGISUB_APPIMAGE_ENABLED=$enableval], - [AEGISUB_APPIMAGE_ENABLED=no]) -AS_IF([test "x$AEGISUB_APPIMAGE_ENABLED" = "xyes"], [ - # Download the AppImage creation tool, transforms the AppDir into an AppImage - AC_MSG_CHECKING([Downloading AppImage creation tool]) - wget https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-`arch`.AppImage -O tools/appimagetool.AppImage -o config.wget.log - chmod 00700 tools/appimagetool.AppImage - AS_IF([test $? -eq 0 ], [ - AC_MSG_RESULT([done]) - ], [ - AC_MSG_FAILURE([failed]) - ]) - - # Downlaod the AppDir management tool, create the AppDir - AC_MSG_CHECKING([Downloading LinuxDeploy creation tool]) - wget https://martinm.iiens.net/linuxdeploy -O tools/linuxdeploy -a config.wget.log - chmod 00700 tools/linuxdeploy - AS_IF([test $? -eq 0 ], [ - AC_MSG_RESULT([done]) - ], [ - AC_MSG_FAILURE([failed]) - ]) -], [ - AC_MSG_NOTICE([Don't build with AppImage support]) -]) - ############################## # Program Support and Features ############################## diff --git a/header.mk b/header.mk index 589122f68c5bb09e097ada8ed4fe2bf1e9670524..faf35b7366772080a8f56fce4883299461a1a706 100644 --- a/header.mk +++ b/header.mk @@ -39,10 +39,12 @@ DISTCLEANFILES += \ $(TOP)aclocal.m4 \ CLEANFILES += \ - $(TOP)Aegisub/usr/bin/aegisub \ $(wildcard $(TOP)Aegisub/usr/lib/*) \ $(TOP)Aegisub-x86_64.AppImage \ +CLEANDIRS += \ + $(TOP)Aegisub \ + define MKDIR_INSTALL @$(BIN_MKDIR_P) $(dir $@) $(BIN_INSTALL) -m644 $< $@ diff --git a/libaegisub/lua/modules/lfs.cpp b/libaegisub/lua/modules/lfs.cpp index 38f29d7928852a64ba247379c0ff366c067b6220..8053b6893a76fc28af0a6a77d308c5a86af398c8 100644 --- a/libaegisub/lua/modules/lfs.cpp +++ b/libaegisub/lua/modules/lfs.cpp @@ -112,7 +112,7 @@ DirectoryIterator *dir_new(const char *path, char **err) const char *get_mode(const char *path, char **err) { - return wrap(err, [ = ]() -> const char * { + return wrap(err, [ = ]() -> const char* { switch (bfs::status(path).type()) { case bfs::file_not_found: return nullptr; break; diff --git a/src/mkv_wrap.cpp b/src/mkv_wrap.cpp index acb4be0e7c9732b0be224ea1f3ad2bdc0c26c282..bc9aa58d97a978112a6e5279b3822a6574cb01a3 100644 --- a/src/mkv_wrap.cpp +++ b/src/mkv_wrap.cpp @@ -105,7 +105,7 @@ struct MkvStdIO final : InputStream { read = &MkvStdIO::Read; scan = &MkvStdIO::Scan; getcachesize = [](InputStream *) -> unsigned int { return 16 * 1024 * 1024; }; - geterror = [](InputStream * st) -> const char * { return ((MkvStdIO *)st)->error.c_str(); }; + geterror = [](InputStream * st) -> const char* { return ((MkvStdIO *)st)->error.c_str(); }; memalloc = [](InputStream *, size_t size) { return malloc(size); }; memrealloc = [](InputStream *, void *mem, size_t size) { return realloc(mem, size); }; memfree = [](InputStream *, void *mem) { free(mem); };