diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..3d4500d8 --- /dev/null +++ b/Makefile @@ -0,0 +1,60 @@ +FFMPEG = transcoder/ffmpeg +CONF_FFMEG = $(FFMPEG)/config.h +FFMPEG_CONF = $(FFMPEG)/configure +FFMPEG_OPT = --pkg-config-flags=--static \ + --disable-shared \ + --enable-static \ + --disable-asm \ + --disable-zlib \ + --disable-iconv \ + --disable-ffplay \ + --disable-ffprobe \ + --disable-ffmpeg + +TRANSCODER_DIR = transcoder/build + +NEEDED = dotnet \ + cmake \ + gcc \ + node \ + npm + +ECHO = @echo -e +COL = \033[1;36m +RED = \033[1;31m +NOCOL = \033[0m + + +all: dependencies transcoder + +dependencies: + @for pkg in $(NEEDED); do \ + $$pkg --version >> /dev/null 2>&1 || ($(ECHO) "$(RED)ERROR: $$pkg could not be found.$(NOCOL)"; exit 1); \ + done + +$(CONF_FFMPEG): + $(ECHO) "$(COL)Configuring FFMPEG$(NOCOL)" + $(FFMPEG_CONF) $(FFMPEG_OPT) + +ffmpeg: $(CONF_FFMPEG) + $(ECHO) "$(COL)Building FFMPEG$(NOCOL)" + $(MAKE) -C $(FFMPEG) + +transcoder: ffmpeg + $(ECHO) "$(COL)Building the transcoder$(NOCOL)" + mkdir --parent $(TRANSCODER_DIR) + cd $(TRANSCODER_DIR) && cmake .. && make + mv $(TRANSCODER_DIR)/libtranscoder.so Kyoo/ + $(ECHO) "$(COL)Transcoder built$(NOCOL)" + + +install: all + $(ECHO) "$(COL)Building the app$(NOCOL)" + @if ! [[ $$(mkdir --parent /opt/kyoo) -eq 0 && -w /opt/kyoo ]]; then echo -e "$(RED)You don't have permissions to install Kyoo. Try to re run with sudo privileges.$(NOCOL)"; exit 1; fi + dotnet publish -c Release -o /opt/kyoo Kyoo/Kyoo.csproj + id -u kyoo &> /dev/null || useradd -rU kyoo + chown -R kyoo /opt/kyoo + chgrp -R kyoo /opt/kyoo + chmod +x /opt/kyoo/kyoo.sh + +.PHONY = all dependencies ffmpeg transcoder diff --git a/build.sh b/build.sh deleted file mode 100755 index a431f1d3..00000000 --- a/build.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# Checking for packages needed to compile the app. -PKG_EXISTS=1 -dotnet --version >> /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "FATAL: dotnet could not be found." - PKG_EXISTS=false - #Should check if the version is greater of equal to 3.0.100 -fi -cmake --version >> /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "FATAL: cmake could not be found." - PKG_EXISTS=false -fi -gcc -v >> /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "FATAL: gcc could not be found." - PKG_EXISTS=false -fi -make -v >> /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "FATAL: make could not be found." - PKG_EXISTS=false -fi -node -v >> /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "FATAL: node could not be found." - PKG_EXISTS=false -fi -npm -v >> /dev/null 2>&1 -if [[ $? -ne 0 ]]; then - echo "FATAL: npm could not be found." - PKG_EXISTS=false -fi - -if [[ PKG_EXISTS -eq false ]]; then - echo "Some requiered packages could not be found. Install them and run this script again." - exit -fi - -echo "All packages are here, building the app..." - - -# Configure ffmpeg. - -echo "Building ffmpeg..." -cd transcoder/ffmpeg -if [[ ! -f "config.h" ]]; then - ./configure --pkg-config-flags=--static --disable-shared --enable-static --disable-zlib --disable-iconv --disable-asm --disable-ffplay --disable-ffprobe --disable-ffmpeg -fi -make -cd .. -echo "Done." - -echo "Building the transcoder..." -mkdir --parent build && cd build -cmake .. -make -cd ../.. -echo "Done" - -echo "Installing the transcoder..." -mv transcoder/build/libtranscoder.so Kyoo/ -echo "Installation complete." \ No newline at end of file diff --git a/ffmpeg-build.txt b/ffmpeg-build.txt deleted file mode 100644 index 19fb77c1..00000000 --- a/ffmpeg-build.txt +++ /dev/null @@ -1,16 +0,0 @@ -Make sure that the ffmpeg-src directory contains a blank snapshot of the ffmpeg source code. -Open the Visual Studio Command Prompt with admin privilege (using the windows start menu). -Make sure that msys64 is installed and nasm is inside the path -Run: "C:\Program Files\Workspace\msys64\msys2_shell.cmd" -mingw64 -use-full-path -Verify that items are link inside the new cmd windows (run which cl and run which link) -Then cd to the ffmpeg source file (cd /c/Projects/Kyoo/ffmpeg-src) - -Then configure the project: -./configure --toolchain=msvc --disable-shared -Or, if you want x64 builds use: -./configure --toolchain=msvc --target-os=win64 --arch=x86_64 --disable-shared -If it doesn't work, try this command: I think that the last part are useless. -./configure --toolchain=msvc --disable-shared --enable-static --extra-libs=-static --extra-cflags=--static -Then run "make". -Then run "make install" -The build can be found in the usr/local/include and usr/local/lib subfolders of your msys64 folder. \ No newline at end of file diff --git a/install.sh b/install.sh index f7eb7748..df9a0936 100755 --- a/install.sh +++ b/install.sh @@ -8,10 +8,4 @@ fi git clone https://github.com/AnonymusRaccoon/Kyoo --recurse cd Kyoo git pull --recurse -chmod +x build.sh -./build.sh -dotnet publish -c Release -o /opt/kyoo Kyoo/Kyoo.csproj -useradd -rU kyoo -chown -R kyoo /opt/kyoo -chgrp -R kyoo /opt/kyoo -chmod +x /opt/kyoo/kyoo.sh +make install