Skip to content
Extraits de code Groupes Projets
Valider cbd48a5f rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Merge branch 'build' into 'master'

Rework build process

See merge request !2
parents 9d1705fe e0550f02
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!2Rework build process
*.App *.App
*.AppImage
*.[oadi] *.[oadi]
*.ass *.ass
*.avi *.avi
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
*.vsp *.vsp
*.y4m *.y4m
*.zip *.zip
*.DirIcon
*~ *~
/bin /bin
...@@ -66,6 +68,7 @@ packages/desktop/aegisub.desktop ...@@ -66,6 +68,7 @@ packages/desktop/aegisub.desktop
packages/desktop/aegisub.desktop.template packages/desktop/aegisub.desktop.template
packages/win_installer/vendor packages/win_installer/vendor
src/aegisub src/aegisub
Aegisub/
src/libresrc/bitmap.cpp src/libresrc/bitmap.cpp
src/libresrc/bitmap.h src/libresrc/bitmap.h
src/libresrc/default_config.cpp src/libresrc/default_config.cpp
...@@ -75,6 +78,7 @@ svn-revision.h ...@@ -75,6 +78,7 @@ svn-revision.h
svn_revision svn_revision
tests/*.json tests/*.json
tests/run tests/run
tools/linuxdeploy
tools/osx-bundle-restart-helper tools/osx-bundle-restart-helper
tools/osx-bundle.sed tools/osx-bundle.sed
tools/repack-thes-dict tools/repack-thes-dict
...@@ -98,5 +102,3 @@ vendor/luajit/src/luajit ...@@ -98,5 +102,3 @@ vendor/luajit/src/luajit
*.tmp *.tmp
cscope.files cscope.files
tags tags
config.guess
config.sub
...@@ -21,6 +21,7 @@ LIB := $(LIB) ...@@ -21,6 +21,7 @@ LIB := $(LIB)
# PLATFORM SETTINGS # PLATFORM SETTINGS
################### ###################
BUILD_DARWIN = @build_darwin@ BUILD_DARWIN = @build_darwin@
BUILD_LINUX = @build_linux@
####### #######
# FLAGS # FLAGS
...@@ -138,3 +139,9 @@ BIN_ECHO = echo ...@@ -138,3 +139,9 @@ BIN_ECHO = echo
BIN_TOUCH = touch BIN_TOUCH = touch
BIN_LUA = @LUA@ BIN_LUA = @LUA@
BIN_WX_CONFIG = @WX_CONFIG_PATH@ BIN_WX_CONFIG = @WX_CONFIG_PATH@
################
# APPIMAGE TOOLS
################
TOOL_LINUXDEPLOY = $(TOM)tools/linuxdeploy
TOOL_APPIMAGE = $(TOP)tools/appimagetool.AppImage
ifneq (yes, $(INCLUDING_CHILD_MAKEFILES)) ifneq (yes, $(INCLUDING_CHILD_MAKEFILES))
COMMANDS := all install clean distclean test depclean osx-bundle osx-dmg test-automation test-libaegisub style tags 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) .PHONY: $(COMMANDS)
.DEFAULT_GOAL := all .DEFAULT_GOAL := all
...@@ -41,10 +44,9 @@ endef ...@@ -41,10 +44,9 @@ endef
$(foreach target,$(LIB),$(eval $(call set_target_flags,$(target),$(TOP)lib/lib$(target).a))) $(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)))) $(foreach target,$(PROGRAM),$(eval $(call set_target_flags,$(notdir $(target)),$(target))))
# Create the build and install targets for programs # Create the build and install targets for programs. Not done with a pattern
# Not done with a pattern rule since the pattern would be just %: and doing that # rule since the pattern would be just %: and doing that leads to make trying
# leads to make trying to use gcc to make any nonexistent targets rather than # to use gcc to make any nonexistent targets rather than erroring
# erroring
define create_program_targets define create_program_targets
ifdef $1_INSTALLNAME ifdef $1_INSTALLNAME
install: $(DESTDIR)$(P_BINDIR)/$($1_INSTALLNAME) install: $(DESTDIR)$(P_BINDIR)/$($1_INSTALLNAME)
...@@ -80,6 +82,7 @@ all: $(LIB_TARGETS) ...@@ -80,6 +82,7 @@ all: $(LIB_TARGETS)
clean: clean:
$(BIN_RM) -f $(OBJ) $(CLEANFILES) $(LIB_TARGETS) $(BIN_RM) -f $(OBJ) $(CLEANFILES) $(LIB_TARGETS)
$(BIN_RM) -rf $(CLEANDIRS)
distclean: clean distclean: clean
$(BIN_RM) -rf $(DISTCLEANFILES) $(DEP) $(BIN_RM) -rf $(DISTCLEANFILES) $(DEP)
...@@ -90,10 +93,14 @@ depclean: clean ...@@ -90,10 +93,14 @@ depclean: clean
install: install:
style: style:
./tools/astyle.bash $(TOP)tools/astyle.bash
tags: tags:
./tools/tags.bash $(TOP)tools/tags.bash
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
# The actual build rules # The actual build rules
.SUFFIXES: .SUFFIXES:
...@@ -115,9 +122,9 @@ POST_FLAGS = $($@_FLAGS) -c -o $@ $< ...@@ -115,9 +122,9 @@ POST_FLAGS = $($@_FLAGS) -c -o $@ $<
.SECONDEXPANSION: .SECONDEXPANSION:
# Libraries contain all object files they depend on (but they may depend on other files) # Libraries contain all object files they depend on (but they may depend on
# Not using libtool on OS X because it has an unsilenceable warning about a # other files). Not using libtool on OS X because it has an unsilenceable
# compatibility issue with BSD 4.3 (wtf) # warning about a compatibility issue with BSD 4.3 (wtf)
lib%.a: $$($$*_OBJ) lib%.a: $$($$*_OBJ)
@$(BIN_MKDIR_P) $(dir $@) @$(BIN_MKDIR_P) $(dir $@)
$(BIN_AR) cru $@ $(filter %.o,$^) $(BIN_AR) cru $@ $(filter %.o,$^)
......
...@@ -56,12 +56,15 @@ On debian buster, the packages are the following: ...@@ -56,12 +56,15 @@ On debian buster, the packages are the following:
- libboost-thread-dev - libboost-thread-dev
- astyle - astyle
### Build the binary
Once all the dependencies are installed, run: Once all the dependencies are installed, run:
```bash ```bash
autoreconf 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 -j$(nproc)
make install
``` ```
You may also consider the following rules: You may also consider the following rules:
...@@ -71,6 +74,24 @@ You may also consider the following rules: ...@@ -71,6 +74,24 @@ You may also consider the following rules:
- `make tags` to build the ctags and cscope databases - `make tags` to build the ctags and cscope databases
- `make style` to format your code with the right style - `make style` to format your code with the right style
### Build an appimage
First, install `patchelf` (`apt install patchelf` or similar for your distro)
and [linuxdeploy](https://github.com/linuxdeploy/linuxdeploy). An AppImage of
linuxdeploy can be found [here](https://martinm.iiens.net/linuxdeploy). You
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.
To build the AppImage, juste use the following commands:
```bash
autoreconf
./configure --with-libpulse --enable-silent-rules --disable-update-checker --without-system-luajit --enable-appimage
make -j$(nproc)
make appimage
```
### Windows ### Windows
Prerequisites: Prerequisites:
......
Fichier déplacé
Fichier déplacé
Fichier déplacé
...@@ -7,12 +7,21 @@ AC_INIT([Aegisub], [aegisub_version],, [aegisub]) ...@@ -7,12 +7,21 @@ AC_INIT([Aegisub], [aegisub_version],, [aegisub])
: ${CFLAGS=""} : ${CFLAGS=""}
: ${CXXFLAGS=""} : ${CXXFLAGS=""}
AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_HEADER([acconf.h]) AC_CONFIG_HEADER([acconf.h])
AC_CONFIG_MACRO_DIR([m4macros]) AC_CONFIG_MACRO_DIR([m4macros])
AC_GNU_SOURCE AC_GNU_SOURCE
AC_CANONICAL_HOST AC_CANONICAL_HOST
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
##########################
# Only run from source dir
##########################
AEGISUB_PATH_SOURCE="$(dirname $(readlink -f "$0"))"
AEGISUB_PATH_BUILD="$(pwd)"
AS_IF([! test "$AEGISUB_PATH_BUILD" = "$AEGISUB_PATH_BUILD"],
[AC_MSG_ERROR([The build directory must be the same as the source directory])])
################### ###################
# Required packages # Required packages
################### ###################
...@@ -41,6 +50,7 @@ AS_CASE([$host], ...@@ -41,6 +50,7 @@ AS_CASE([$host],
[*-*-linux*], [build_linux="yes"]) [*-*-linux*], [build_linux="yes"])
AC_SUBST(build_darwin) AC_SUBST(build_darwin)
AC_SUBST(build_linux)
######################## ########################
# Configurable variables # Configurable variables
...@@ -75,6 +85,48 @@ AC_SUBST(P_ICON) ...@@ -75,6 +85,48 @@ AC_SUBST(P_ICON)
# set it to $ac_default_prefix if it hasn't been supplied. # set it to $ac_default_prefix if it hasn't been supplied.
AS_CASE([x$prefix], [xNONE | x], [prefix="$ac_default_prefix"], []) 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"], [
# Check more binaries
AC_PATH_PROG([PATCHELF], [patchelf])
AC_PATH_PROG([WGET], [wget])
AC_PATH_PROG([CHMOD], [chmod])
AS_IF([test "$PATCHELF" = "notfound"], [AC_MSG_ERROR([patchelf is required for AppImage generation])])
AS_IF([test "$WGET" = "notfound"], [AC_MSG_ERROR([wget is required for AppImage generation])])
AS_IF([test "$CHMOD" = "notfound"], [AC_MSG_ERROR([chmod is required for AppImage generation])])
# 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. # Install prefix used by wxStandardPaths::SetInstallPrefix.
AC_DEFINE_UNQUOTED([INSTALL_PREFIX], ["$prefix"], [Default install prefix, or --prefix.]) AC_DEFINE_UNQUOTED([INSTALL_PREFIX], ["$prefix"], [Default install prefix, or --prefix.])
......
...@@ -33,11 +33,22 @@ DISTCLEANFILES += \ ...@@ -33,11 +33,22 @@ DISTCLEANFILES += \
$(TOP)build/git_version.h \ $(TOP)build/git_version.h \
$(TOP)Makefile.inc \ $(TOP)Makefile.inc \
$(TOP)config.log \ $(TOP)config.log \
$(TOP)config.wget.log \
$(TOP)acconf.h.in \ $(TOP)acconf.h.in \
$(TOP)config.status \ $(TOP)config.status \
$(TOP)autom4te.cache \ $(TOP)autom4te.cache \
$(TOP)aclocal.m4 \ $(TOP)aclocal.m4 \
CLEANFILES += \
$(wildcard $(TOP)Aegisub/usr/lib/*) \
$(TOP)Aegisub-x86_64.AppImage \
$(TOP)cscope.files \
$(TOP)cscope.out \
$(TOP)tags \
CLEANDIRS += \
$(TOP)Aegisub \
define MKDIR_INSTALL define MKDIR_INSTALL
@$(BIN_MKDIR_P) $(dir $@) @$(BIN_MKDIR_P) $(dir $@)
$(BIN_INSTALL) -m644 $< $@ $(BIN_INSTALL) -m644 $< $@
......
[Desktop Entry]
Version=1.0
Type=Application
Name=Aegisub
Icon=aegisub
GenericName=Subtitle Editor
Comment=Create and edit subtitles for film and videos.
Keywords=subtitles;video;audio;text
Terminal=false
Categories=AudioVideo;AudioVideoEditing;
MimeType=application/x-srt;text/plain;text/x-ass;text/x-microdvd;text/x-ssa;
StartupNotify=true
Exec=aegisub
64x64.png
\ No newline at end of file
#!/usr/bin/env lua
-- Needs awk and a shell (usually bash / sh) and ldd, which is a Linux utility.
-- Thus run only this script on a Linux env or where the .so files can be found
-- with the ldd command.
if not arg or #arg ~= 2 then os.exit(1) end
io.stdout:write(string.format('Running for file %s\n', arg[1]))
io.stdout:write(string.format('Dest folder is %s\n', arg[2]))
-- Libs tables
LIBS_WRITE = {}
LIBS_READ = {}
-- Capture the output of a command
function os.capture(cmd)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
return s
end
-- Simple copy of a table, it doesn't work with metatables and recursive tables
function copy_simple(obj)
if type(obj) ~= 'table' then return obj end
local res = {}
for k, v in pairs(obj) do res[copy_simple(k)] = copy_simple(v) end
return res
end
-- Add the content of t2 in t1
function concatenate(t1, t2)
for name, file in pairs(t2) do
t1[name] = file
end
end
-- Get the number of elements in a table
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
-- The ldd command line utility, but in lua
function ldd(file)
local libs = {}
local cmd = string.format('ldd %s | awk \'$2 = "=>" && $3 { print $1 " " $3 }\'', arg[1])
local out = os.capture(cmd)
for name, file in out:gmatch("([^\n ]*) ([^\n ]*)[\n]") do
libs[name] = file
end
return libs
end
-- Add NEEDS for each lib while there are some added. It's like a dataflow algorithme.
LIBS_WRITE = ldd(arg[1])
while tablelength(LIBS_READ) ~= tablelength(LIBS_WRITE) do
LIBS_READ = copy_simple(LIBS_WRITE)
for name, file in pairs(LIBS_READ) do
concatenate(LIBS_WRITE, ldd(file))
end
end
io.stdout:write(string.format("Cleaning %s", arg[2]))
os.execute(string.format("rm -f %s/*", arg[2]))
for name, file in pairs(LIBS_WRITE) do
local cmd = string.format('cp %s %s/%s && chmod 555 %s/%s',
file, arg[2], name, arg[2], name)
os.execute(cmd)
end
io.stdout:write(string.format("Copied %d libraries to %s\n", tablelength(LIBS_WRITE), arg[2]))
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter