diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index 11c317d0affc06ce75b97a77c25c1db4081575c1..0000000000000000000000000000000000000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**", - "${workspaceFolder}/inc/**", - "/usr/include/qt6/QtCore", - "/usr/include/qt6/QtWidgets", - "/usr/include/qt6/QtGui", - "/usr/include/qt6" - ], - "defines": [ - "LKT_OS_TOASTER=1", - "LKT_STATIC_MODULE=1", - "_POSIX_C_SOURCE=200809L" - ], - "compilerPath": "/usr/bin/clang", - "cStandard": "c17", - "cppStandard": "c++17", - "intelliSenseMode": "linux-clang-x64", - "compileCommands": "/home/kubat/WORK/lektor/build/compile_commands.json" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 8f485e803069e035995dad41716b78c27d28756c..f42032653436e2c53c317cd8f92c296cb100a851 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,13 @@ { - "files.exclude": { - "**/src": true, - "**/inc": true, - "**/rust": true, - }, -} \ No newline at end of file + "settings": { + "ltex.language": "en", + "languageTool.language": "en", + "editor.formatOnSave": true, + "json.format.enable": true, + "rust-analyzer.checkOnSave.command": "clippy", + "rust-analyzer.inlayHints.parameterHints.enable": false, + "rust-analyzer.diagnostics.enable": true, + "rust-analyzer.procMacro.enable": true, + "rust-analyzer.procMacro.attributes.enable": true, + } +} diff --git a/inc/.vscode/c_cpp_properties.json b/inc/.vscode/c_cpp_properties.json deleted file mode 100644 index 1fbbd3960fb57ff26930709d57bc291d2f1b2f53..0000000000000000000000000000000000000000 --- a/inc/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**", - "${workspaceFolder}/inc/**", - "/usr/include/qt6/QtCore", - "/usr/include/qt6/QtWidgets", - "/usr/include/qt6/QtGui", - "/usr/include/qt6" - ], - "defines": [ - "LKT_OS_TOASTER=1", - "LKT_STATIC_MODULE=1", - "_POSIX_C_SOURCE=200809L" - ], - "compilerPath": "/usr/bin/clang", - "cStandard": "c17", - "cppStandard": "c++17", - "intelliSenseMode": "linux-clang-x64" - } - ], - "version": 4 -} diff --git a/lektor.code-workspace b/lektor.code-workspace deleted file mode 100644 index 53d9c2e6ef3ee85e73e296126edee70ee5ce9926..0000000000000000000000000000000000000000 --- a/lektor.code-workspace +++ /dev/null @@ -1,31 +0,0 @@ -{ - "folders": [ - { - "path": ".", - "name": "Root Folder" - }, - { - "path": "inc", - "name": "Includes" - }, - { - "path": "src", - "name": "C/C++ Sources" - }, - { - "path": "src/rust", - "name": "Rust Sources" - }, - ], - "settings": { - "ltex.language": "en", - "languageTool.language": "en", - "editor.formatOnSave": true, - "json.format.enable": true, - "rust-analyzer.checkOnSave.command": "clippy", - "rust-analyzer.inlayHints.parameterHints.enable": false, - "rust-analyzer.diagnostics.enable": true, - "rust-analyzer.procMacro.enable": true, - "rust-analyzer.procMacro.attributes.enable": true, - } -} \ No newline at end of file diff --git a/src/rust/rsc/AmadeusLogo.jpg b/rsc/AmadeusLogo.jpg similarity index 100% rename from src/rust/rsc/AmadeusLogo.jpg rename to rsc/AmadeusLogo.jpg diff --git a/src/rust/rsc/IPAMincho.ttf b/rsc/IPAMincho.ttf similarity index 100% rename from src/rust/rsc/IPAMincho.ttf rename to rsc/IPAMincho.ttf diff --git a/src/rust/rsc/UbuntuMono-Regular.ttf b/rsc/UbuntuMono-Regular.ttf similarity index 100% rename from src/rust/rsc/UbuntuMono-Regular.ttf rename to rsc/UbuntuMono-Regular.ttf diff --git a/src/rust/rsc/UbuntuMono-UFL.txt b/rsc/UbuntuMono-UFL.txt similarity index 100% rename from src/rust/rsc/UbuntuMono-UFL.txt rename to rsc/UbuntuMono-UFL.txt diff --git a/src/.vscode/c_cpp_properties.json b/src/.vscode/c_cpp_properties.json deleted file mode 100644 index d960b3470ade82ef25411b3dc2e30844b16316b3..0000000000000000000000000000000000000000 --- a/src/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**", - "${workspaceFolder}/../inc/**", - "/usr/include/qt6/QtCore", - "/usr/include/qt6/QtWidgets", - "/usr/include/qt6/QtGui", - "/usr/include/qt6" - ], - "defines": [ - "LKT_OS_TOASTER=1", - "LKT_STATIC_MODULE=1", - "_POSIX_C_SOURCE=200809L" - ], - "compilerPath": "/usr/bin/clang", - "cStandard": "c17", - "cppStandard": "c++17", - "intelliSenseMode": "linux-clang-x64" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/src/.vscode/settings.json b/src/.vscode/settings.json deleted file mode 100644 index 0d6f1e06aad7b1025de7f83f0b02ac6c57165b65..0000000000000000000000000000000000000000 --- a/src/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "files.exclude": { - "/rust": true, - "rust/": true, - "**/rust": true, - }, -} \ No newline at end of file diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 0462249c51143cd2aee446fb159f750ddd05e6b8..46c0f0b592b9f63d0ee00674515d041235cd2103 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -14,7 +14,7 @@ members = [ # Clients "amadeus", "amalib", - "lkt-rs", + "lkt", ] [workspace.package] diff --git a/src/rust/lkt-rs/Cargo.toml b/src/rust/lkt/Cargo.toml similarity index 90% rename from src/rust/lkt-rs/Cargo.toml rename to src/rust/lkt/Cargo.toml index c9757ad5717988d728efdca93f420a965b37222d..2f6211ab90b2ec9ed807ba9c0c82c660f4015e7f 100644 --- a/src/rust/lkt-rs/Cargo.toml +++ b/src/rust/lkt/Cargo.toml @@ -1,14 +1,10 @@ [package] -name = "lkt-rs" +name = "lkt" version.workspace = true edition.workspace = true authors.workspace = true license.workspace = true -[[bin]] -name = "lkt" -path = "src/main.rs" - [dependencies] tokio.workspace = true serde.workspace = true diff --git a/src/rust/lkt-rs/src/args.rs b/src/rust/lkt/src/args.rs similarity index 100% rename from src/rust/lkt-rs/src/args.rs rename to src/rust/lkt/src/args.rs diff --git a/src/rust/lkt-rs/src/config.rs b/src/rust/lkt/src/config.rs similarity index 100% rename from src/rust/lkt-rs/src/config.rs rename to src/rust/lkt/src/config.rs diff --git a/src/rust/lkt-rs/src/main.rs b/src/rust/lkt/src/main.rs similarity index 100% rename from src/rust/lkt-rs/src/main.rs rename to src/rust/lkt/src/main.rs diff --git a/src/rust/lkt-rs/src/parsers.rs b/src/rust/lkt/src/parsers.rs similarity index 100% rename from src/rust/lkt-rs/src/parsers.rs rename to src/rust/lkt/src/parsers.rs diff --git a/utils/cmake/FindSDL2_image.cmake b/utils/cmake/FindSDL2_image.cmake deleted file mode 100644 index e9a20442e045b9146a29fa51f6b125cad738fdf6..0000000000000000000000000000000000000000 --- a/utils/cmake/FindSDL2_image.cmake +++ /dev/null @@ -1,100 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindSDL2_image -# ------------- -# -# Locate SDL2_image library -# -# This module defines: -# -# :: -# -# SDL2_IMAGE_LIBRARIES, the name of the library to link against -# SDL2_IMAGE_INCLUDE_DIRS, where to find the headers -# SDL2_IMAGE_FOUND, if false, do not try to link against -# SDL2_IMAGE_VERSION_STRING - human-readable string containing the -# version of SDL2_image -# -# -# -# For backward compatibility the following variables are also set: -# -# :: -# -# SDL2IMAGE_LIBRARY (same value as SDL2_IMAGE_LIBRARIES) -# SDL2IMAGE_INCLUDE_DIR (same value as SDL2_IMAGE_INCLUDE_DIRS) -# SDL2IMAGE_FOUND (same value as SDL2_IMAGE_FOUND) -# -# -# -# $SDLDIR is an environment variable that would correspond to the -# ./configure --prefix=$SDLDIR used in building SDL. -# -# Created by Eric Wing. This was influenced by the FindSDL.cmake -# module, but with modifications to recognize OS X frameworks and -# additional Unix paths (FreeBSD, etc). - -if(NOT SDL2_IMAGE_INCLUDE_DIR AND SDL2IMAGE_INCLUDE_DIR) - set(SDL2_IMAGE_INCLUDE_DIR ${SDL2IMAGE_INCLUDE_DIR} CACHE PATH "directory cache entry initialized from old variable name") -endif() -find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h - HINTS - ENV SDL2IMAGEDIR - ENV SDL2DIR - ${SDL2_DIR} - PATH_SUFFIXES SDL2 - # path suffixes to search inside ENV{SDL2DIR} - include/SDL2 include -) - -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(VC_LIB_PATH_SUFFIX lib/x64) -else() - set(VC_LIB_PATH_SUFFIX lib/x86) -endif() - -if(NOT SDL2_IMAGE_LIBRARY AND SDL2IMAGE_LIBRARY) - set(SDL2_IMAGE_LIBRARY ${SDL2IMAGE_LIBRARY} CACHE FILEPATH "file cache entry initialized from old variable name") -endif() -find_library(SDL2_IMAGE_LIBRARY - NAMES SDL2_image - HINTS - ENV SDL2IMAGEDIR - ENV SDL2DIR - ${SDL2_DIR} - PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} -) - -if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h") - file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") - file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL2_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") - string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL2_IMAGE_VERSION_MAJOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL2_IMAGE_VERSION_MINOR_LINE}") - string(REGEX REPLACE "^#define[ \t]+SDL2_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL2_IMAGE_VERSION_PATCH_LINE}") - set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH}) - unset(SDL2_IMAGE_VERSION_MAJOR_LINE) - unset(SDL2_IMAGE_VERSION_MINOR_LINE) - unset(SDL2_IMAGE_VERSION_PATCH_LINE) - unset(SDL2_IMAGE_VERSION_MAJOR) - unset(SDL2_IMAGE_VERSION_MINOR) - unset(SDL2_IMAGE_VERSION_PATCH) -endif() - -set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY}) -set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image - REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS - VERSION_VAR SDL2_IMAGE_VERSION_STRING) - -# for backward compatibility -set(SDL2IMAGE_LIBRARY ${SDL2_IMAGE_LIBRARIES}) -set(SDL2IMAGE_INCLUDE_DIR ${SDL2_IMAGE_INCLUDE_DIRS}) -set(SDL2IMAGE_FOUND ${SDL2_IMAGE_FOUND}) - -mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR) diff --git a/utils/desktop/Amadeus.desktop b/utils/desktop/Amadeus.desktop new file mode 100644 index 0000000000000000000000000000000000000000..16b464f42d7085f86517a4fd1c61c4170adb3087 --- /dev/null +++ b/utils/desktop/Amadeus.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Amadeus +Icon=amadeus +GenericName=Amadeus +Comment=The Amadeus client for lektord +Keywords=video;audio +Terminal=true +Categories=AudioVideo; +StartupNotify=true +Exec=lektord -F diff --git a/utils/desktop/lektord.desktop b/utils/desktop/Lektord.desktop similarity index 100% rename from utils/desktop/lektord.desktop rename to utils/desktop/Lektord.desktop diff --git a/utils/desktop/amadeus.jpg b/utils/desktop/amadeus.jpg new file mode 100644 index 0000000000000000000000000000000000000000..62b445c1c20d056de0b3badafe7d845733a78694 Binary files /dev/null and b/utils/desktop/amadeus.jpg differ diff --git a/utils/samples/README.md b/utils/samples/README.md deleted file mode 100644 index bf969d55f0760c38819709f570938efd6897d71b..0000000000000000000000000000000000000000 --- a/utils/samples/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Sample files that you can use - -You will need to replace all the `dot-` by `.` to use those files. - -- `.ccls`, place it at the root of the project. Used for coc/ccls - integration in vim. -- `.vimrc`, some default for vim. Use that to not have clang-format - change all of the formating. -- `.ycm_extra_conf.py`, a default file found somewhere to use - YouCompleteMe in vim. diff --git a/utils/samples/dot-ccls b/utils/samples/dot-ccls deleted file mode 100644 index ad18f4fcc823bf52a72cb28790f18ddd6649c13a..0000000000000000000000000000000000000000 --- a/utils/samples/dot-ccls +++ /dev/null @@ -1,16 +0,0 @@ --isystem -/usr/local/include --isystem -/usr/lib/llvm-11/lib/clang/11.0.0/include --isystem -/usr/include/x86_64-linux-gnu --isystem -/usr/include/SDL2 --isystem -/usr/include --I -./inc --I -./build.clang/inc --std=c11 --fPIC diff --git a/utils/samples/dot-vimrc b/utils/samples/dot-vimrc deleted file mode 100644 index db636cdc28932f7679bc34cb5d30bb576a8c034f..0000000000000000000000000000000000000000 --- a/utils/samples/dot-vimrc +++ /dev/null @@ -1,3 +0,0 @@ -" set softtabstop=4 -set tabstop=4 -set shiftwidth=4 diff --git a/utils/samples/dot-ycm_extra_conf.py b/utils/samples/dot-ycm_extra_conf.py deleted file mode 100644 index 63660d21c120eddaeff38861f49810fd80e7d9b4..0000000000000000000000000000000000000000 --- a/utils/samples/dot-ycm_extra_conf.py +++ /dev/null @@ -1,236 +0,0 @@ -import ycm_core -from os import getcwd -from os.path import abspath, join, isabs, normpath, exists, splitext, dirname - -default_flags = [ "-Wall", "-Wextra" ] -c_header_extensions = [ ".h" ] -c_source_extensions = [ ".c" ] -c_additional_flags = [ "-x", "c", "-std=c11", "-I", "./inc/" ] -cpp_header_extensions = [ ".h", ".hh", ".H", ".hp", ".hpp", ".HPP", ".hxx", ".h++" ] -cpp_source_extensions = [ ".cp", ".cpp", ".CPP", ".cc", ".C", ".cxx", ".c++" ] -cpp_additional_flags = [ "-x", "c++", "-std=c++17" ] - -def find_file_recursively(file_name, start_dir = getcwd(), stop_dir = None): - cur_dir = abspath(start_dir) if not isabs(start_dir) else start_dir - while True: - if exists(join(cur_dir, file_name)): - return join(cur_dir, file_name) - - parent_dir = dirname(cur_dir) - - if parent_dir == cur_dir or parent_dir == stop_dir: - return None - - else: - cur_dir = parent_dir - - -def file_exists(file_name, start_dir = getcwd()): - return find_file_recursively(file_name, start_dir) is not None - -def make_path_absolute(path, base_dir=getcwd()): - if isabs(path): return path - else: return join(base_dir, path) - -def script_directory(): - return dirname(__file__) - -def is_header(file_path): - return is_c_header(file_path) or is_cpp_header(file_path) - -def is_c_header(file_path): - (_, extension) = splitext(file_path) - return extension in c_header_extensions - -def is_cpp_header(file_path): - (_, extension) = splitext(file_path) - return extension in cpp_header_extensions - -def is_source(file_path): - return is_c_source(file_path) or is_cpp_source(file_path) - -def is_c_source(file_path): - (_, extension) = splitext(file_path) - return extension in c_source_extensions - -def is_cpp_source(file_path): - (_, extension) = splitext(file_path) - return extension in cpp_source_extensions - -def is_c_file(file_path): - return is_c_source(file_path) or is_c_header(file_path) - -def is_cpp_file(file_path): - return is_cpp_source(file_path) or is_cpp_header(file_path) - -def make_absolute_flags(flags, base_dir): - next_is_path = [ "-I", "-isystem", "-iquote" ] - argument_is_path = [ "--sysroot=" ] - updated_flags = [] - make_absolute = False - - for flag in flags: - updated_flag = flag - - if make_absolute: - updated_flag = make_path_absolute(flag, base_dir) - make_absolute = False - - if flag in next_is_path: - make_absolute = True - - for f in next_is_path: - if flag.startswith(f): - path = flag[len(f):].lstrip() - updated_flags.append(f) - updated_flag = make_path_absolute(path, base_dir) - break - - for f in argument_is_path: - if flag.startswith(f): - path = flag[len(f):].lstrip() - updated_flag = f + make_path_absolute(path, base_dir) - break - - updated_flags.append(updated_flag) - - return updated_flags - -def strip_flags(flags): - return [flag.strip() for flag in flags] - -def make_final_flags(file_name, flags, base_dir = getcwd()): - stripped = strip_flags(flags) - absolute = make_absolute_flags(stripped, base_dir) - - if is_cpp_file(file_name): final = save_add_flags(absolute, cpp_additional_flags) - elif is_c_file(file_name): final = save_add_flags(absolute, c_additional_flags) - else: final = absolute - - return create_result(final) - -def save_add_flags(old_flags, additional_flags): - skip_next_af = False - - for j in range(len(additional_flags)): - af = additional_flags[j].strip() - argument_type = "none" - to_add = True - - if skip_next_af: - skip_next_af = False - continue - - if len(additional_flags) > j + 1 and not additional_flags[j+1].startswith("-"): - argument_type = "next" - skip_next_af = True - af_arg = additional_flags[j+1].strip() - - elif af.find(" ") != -1: - pos = af.find(" ") - argument_type = "next" - af_arg = af[pos+1:].strip() - af = af[:pos] - - elif af.find("=") != -1: - pos = af.find("=") - argument_type = "same" - af_arg = af[pos+1:].strip() - af = af[:pos] - - skip_next_of = False - - for i in range(len(old_flags)): - of = old_flags[i].strip() - - if skip_next_of: - skip_next_of = False - continue - - if argument_type == "none": - if of == af: - to_add = False - break - - elif argument_type == "next": - if of == af: - to_add = False - skip_next_of = True - break - - elif of.startswith(af) and of[len(af)] == " ": - to_add = False - break - - elif of.startswith(af): - to_add = False - break - - elif argument_type == "same": - if of.startswith(af): - if len(of) > len(af) + 1 and of[len(af)] == "=": - to_add = False - break - - elif len(of) == len(af) + 1 and of[len(af)] == "=": - to_add = False - skip_next_of = True - break - - elif len(of) == len(af) and len(old_flags) > i + 1 and old_flags[i+1].strip().startswith("="): - to_add = False - skip_next_of = True - break - - if to_add: - if argument_type == "none": old_flags.append(af) - elif argument_type == "next": old_flags.extend([af, af_arg]) - elif argument_type == "same": old_flags.append("{}={}".format(af, af_arg)) - - return old_flags - -def create_result(flags, do_cache = True, **kwargs): - ret = {"flags": flags, "do_cache": do_cache} - return dict(ret, **kwargs) - -def parse_compile_commands(file_name, search_base = getcwd()): - database_path = dirname(find_file_recursively("compile_commands.json", search_base)) - database = ycm_core.CompilationDatabase(database_path) - - if is_header(file_name): - (name,_) = splitext(file_name) - - for ext in (c_source_extensions + cpp_source_extensions): - alternative_name = name + ext - - if exists(alternative_name): - compilation_info = database.GetCompilationInfoForFile(alternative_name) - - if (compilation_info.compiler_flags_): - return make_final_flags(file_name, compilation_info.compiler_flags_, - compilation_info.compiler_working_dir_) - - elif is_source(file_name): - compilation_info = database.GetCompilationInfoForFile(file_name) - - if (compilation_info.compiler_flags_): - return make_final_flags(file_name, compilation_info.compiler_flags_, compilation_info.compiler_working_dir_) - - return parse_default_flags(file_name) - -def parse_clang_complete(file_name, search_base = getcwd()): - config = find_file_recursively(".clang_complete", search_base) - config_path = dirname(config) - - with open(config, "r") as config_file: - flags = config_file.read().splitlines() - return make_final_flags(file_name, flags, config_path) - -def parse_default_flags(file_name): - return make_final_flags(file_name, default_flags, script_directory()) - -def FlagsForFile(file_name, **kwargs): - search_base = dirname(file_name) - if file_exists("compile_commands.json", search_base): return parse_compile_commands(file_name, search_base) - elif file_exists(".clang_complete", search_base): return parse_clang_complete(file_name, search_base) - else: return parse_default_flags(file_name) diff --git a/utils/scripts/depends.bash b/utils/scripts/depends.bash deleted file mode 100755 index 8e9e5613fbd85f3698aac8a1ee78b3c214a0b8fc..0000000000000000000000000000000000000000 --- a/utils/scripts/depends.bash +++ /dev/null @@ -1,199 +0,0 @@ -#!/bin/bash - -DEPENDS_FILE=depends/depends.txt -RULES_FILE=depends/rules.txt -BUILD_DIR="$1" -ROOT_DIR="$PWD" -NPROC=`getconf _NPROCESSORS_ONLN` -ABS_BUILD_DIR=`realpath $BUILD_DIR` - -function die () -{ - echo "ERROR: $*" - exit 1 -} - -function curl () -{ - $CURL $1 --output $2 2>/dev/null >/dev/null - [ $? -ne 0 ] && die "Failed to download $1 and save it to $2" -} - -function wget () -{ - $WGET $1 -O $2 2>/dev/null >/dev/null - [ $? -ne 0 ] && die "Failed to download $1" -} - -function git () -{ - local URL=$1 - local DEST=$2 - shift 2 - $GIT clone $URL $DEST $* - [ $? -ne 0 ] && die "Failed to clone $URL into folder $DEST with options $OPT" -} - -function cmake () -{ - $CMAKE $* -} - -function get () -{ - local NUM=$1 - shift - echo $* | cut -d' ' -f$NUM - -} - -function get_from () -{ - local NUM=$1 - shift - echo $* | cut -d' ' -f$NUM- - -} - -function untar () -{ - local OLD=`tar tf depends/$1 | cut -d'/' -f1 - | uniq` - (cd depends && $TAR xzf $1 --transform="s!^$OLD!$2!") -} - -[ "x${BUILD_DIR}" = "x" ] && die "You must specify the lektor's build folder as the first argument" -echo "Lektor's build file is $BUILD_DIR" - -CURL=`which curl 2>/dev/null` -[ $? -ne 0 ] && die "Failed to find the curl binary" -WGET=`which wget 2>/dev/null` -[ $? -ne 0 ] && die "Failed to find the wget binary" - -TAR=`which tar 2>/dev/null` -[ $? -ne 0 ] && die "Failed to find the tar binary" -GIT=`which git 2>/dev/null` -[ $? -ne 0 ] && die "Failed to find the git binary" -CMAKE=`which cmake 2>/dev/null` -[ $? -ne 0 ] && die "Failed to find the cmake binary" - -! [ -f $DEPENDS_FILE ] && die "You must run this script from the root of the project" -! [ -f $PWD/utils/scripts/depends.bash ] && die "You must run thus script from the root of the project" -! [ -d $BUILD_DIR/depends_install ] && mkdir $BUILD_DIR/depends_install -! [ -d $BUILD_DIR/depends_install ] && die "Failed to create depends install folder" - -######################### -# Download dependencies # -######################### - -! [ -d depends ] && mkdir depends - -while read LINE -do - FUNC=`get 1 $LINE` - FOLD=`get 2 $LINE` - URL=`get 3 $LINE` - DEST=`get 4 $LINE` - OPT=`get_from 5 $LINE` - - if [ -f depends/$DEST ] || [ -d depends/$DEST ] - then - echo "Dependency $FOLD is already downloaded," \ - "remove depends/$DEST and depends/$DEST to re-download it" - continue - fi - - echo "Downloading $FOLD from $URL to depends/$DEST" - case $FUNC in - wget) - wget $URL depends/$DEST - ;; - curl) - curl $URL depends/$DEST - ;; - git) - git $URL depends/$DEST $OPT - ;; - esac -done < $DEPENDS_FILE - -################################## -# Extract dependencies and build # -################################## - -while read LINE -do - FOLD=`get 2 $LINE` - FILE=`get 4 $LINE` - if [ -d depends/$FOLD ] - then - echo "Skip already extracted folder depends/$FOLD" - continue - fi - echo "Extract file depends/$FILE to depends/$FOLD" - untar $FILE $FOLD -done < $DEPENDS_FILE - -while read LINE -do - FOLD=`get 1 $LINE` - TYPE=`get 2 $LINE` - OPT=`get_from 3 $LINE` - - # Replace __VARIABLES__ from the OPT variable - OPT=`echo "$OPT" | sed -e "s+__BUILD_DIR__+$BUILD_DIR/depends_install/+g"` - - ! [ -d $BUILD_DIR/depends/$FOLD ] && mkdir -p $BUILD_DIR/depends/$FOLD - ! [ -d $BUILD_DIR/depends/$FOLD ] && die "Failed to create the build folder" \ - "for $FOLD" - - if [ -f $BUILD_DIR/depends/$FOLD/.lektor ] - then - echo "Skip already built folder $FOLD, if you want to rebuild it," \ - "remove file $BUILD_DIR/depends/$FOLD/.lektor" - continue - fi - - # Go to right folder - cd $BUILD_DIR/depends/$FOLD - - # Install method, i.e. install_sw or install - INSTALL="install" - - # Types of builds - case "$TYPE" in - configure) - $ROOT_DIR/depends/$FOLD/configure --prefix=$ABS_BUILD_DIR/depends_install CC=$CC CXX=$CXX $OPT - [ $? -ne 0 ] && die "Failed to configure $FOLD" - ;; - zconfigure) - # The CC= and CXX= doesn't work for zlib - # TODO pour le Kubat du futur: trouver un moyen uniforme de passer le '-fPIC' - CC=$CC CXX=$CXX CFLAGS="-fPIC -Wno-error" $ROOT_DIR/depends/$FOLD/configure --prefix=$ABS_BUILD_DIR/depends_install $OPT - [ $? -ne 0 ] && die "Failed to configure $FOLD" - ;; - sslconfigure) - # Yes, we need to call Configure and not configure here... - # TODO pour le Kubat du futur: trouver un moyen de pas ardcoder le linux-x86_64 (build FreeBSD, OSX et autres) - CC=$CC CXX=$CXX $ROOT_DIR/depends/$FOLD/Configure --prefix=$ABS_BUILD_DIR/depends_install $OPT linux-x86_64 - [ $? -ne 0 ] && die "Failed to configure $FOLD" - INSTALL="install_sw" - ;; - cmake) - # Yes, some projects build with cmake, will be deleted in future commits - CC=$CC CXX=$CXX cmake $ROOT_DIR/depends/$FOLD/ $OPT - [ $? -ne 0 ] && die "Failed to configure $FOLD" - esac - - # Common part - make -j$NPROC - [ $? -ne 0 ] && die "Failed to make $FOLD, build folder is $BUILD_DIR/depends/$FOLD" - make $INSTALL - [ $? -ne 0 ] && die "Failed to install $FOLD, build folder is " \ - "$BUILD_DIR/depends/$FOLD, install folder " \ - "is $ROOT_DIR/depends_install" - - # Exit folder and mark it as compiled - touch .lektor - cd $ROOT_DIR - echo "Finished to build $FOLD, result is in $BUILD_DIR/depends/$FOLD" -done < $RULES_FILE - -# vim:syntax=sh ts=4 sw=4 expandtab