{
    "##": "This manifest is in Extras because of elaborated pre/post install script",
    "version": "2.24.0",
    "description": "SDL_ttf is a library that provides support for TrueType (.ttf) font files with Simple Directmedia Layer.",
    "homepage": "https://github.com/libsdl-org/SDL_ttf",
    "license": "Zlib",
    "url": [
        "https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.24.0/SDL2_ttf-devel-2.24.0-VC.zip",
        "https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.24.0/SDL2_ttf-2.24.0.zip"
    ],
    "hash": [
        "2dea8ea01e04756ead27e196a681034ed71342562a75b512ea279fcdfde83307",
        "bef50614acb63347fe1612facabb31b0f1a05ca2b5c271a619c26fdae561a1c9"
    ],
    "installer": {
        "script": [
            "# SDL2_ttf is library containing a header file and a collection of dlls.",
            "# 'Installing' SDL2_ttf implies the following steps:",
            "#",
            "#",
            "#-------------------------------------------------------------------#",
            "# 1) Re-organize files into a standard scoop structure.",
            "#-------------------------------------------------------------------#",
            "# 1.1 Create helper variables",
            "$src_dir = \"$dir\\SDL2_ttf-$version\\\"",
            "#",
            "# 1.2 Create directories to store the library",
            "mkdir -f \"$dir\\lib\\pkgconfig\" > $null",
            "mkdir -f \"$dir\\include\\SDL2_ttf\" > $null",
            "#",
            "# 1.3 make arch consistent with scoop naming",
            "mv \"$src_dir\\lib\\x86\" \"$src_dir\\lib\\32bit\"",
            "mv \"$src_dir\\lib\\x64\" \"$src_dir\\lib\\64bit\"",
            "#",
            "# 1.4 Only keep the relevent architecture",
            "mv \"$src_dir\\lib\\$architecture\\*\" \"$dir\\lib\"",
            "#",
            "# 1.5 Move the header file",
            "mv \"$src_dir\\include\\*.h\"  \"$dir\\include\\SDL2_ttf\"",
            "Write-Host \"Intalling the $app ($architecture) library to $dir.\"",
            "#",
            "#",
            "#-------------------------------------------------------------------#",
            "# 2) Configure pck-config file with the library data.",
            "#-------------------------------------------------------------------#",
            "# 2.1 Create helper variables.",
            "$pc_in = \"$src_dir\\SDL2_ttf.pc.in\"",
            "$pc_out = \"$dir\\lib\\pkgconfig\\SDL2_ttf.pc\"",
            "$cm_dir = if (get_config NO_JUNCTIONS) { $dir } else { \"$(appdir $app $global)\\current\" }",
            "$pc_dir = \"$cm_dir\\lib\\pkgconfig\"",
            "#",
            "# 2.2 Configure the pck-config file.",
            "Set-Content $pc_out ((gc $pc_in) `",
            "    -replace \"@prefix@\",\"\" `",
            "    -replace \"@exec_prefix@\",\"`${prefix}\" `",
            "    -replace \"@libdir@\",\"`${exec_prefix}/lib\" `",
            "    -replace \"@includedir@\",\"`${prefix}/include\" `",
            "    -replace \"@PACKAGE@\",\"SDL2_ttf\" `",
            "    -replace \"@VERSION@\",\"$version\" `",
            "    -replace \"@SDL_VERSION@\",\"2.0.0\" `",
            ")",
            "#",
            "# 2.3 Make the library discoverable by adding the path to the Env variables.",
            "# 2.3.1 Do it for the future sessions",
            "# 2.3.1.1 For pck-config user",
            "$null, $currpath = Split-PathLikeEnvVar -Pattern $pc_dir -Path (Get-EnvVar -Name 'PKG_CONFIG_PATH' -Global:$global)",
            "Write-Host \"Adding $app to PKG_CONFIG_PATH.\"",
            "Set-EnvVar -Name 'PKG_CONFIG_PATH' -Value \"$pc_dir;$currpath\" -Global:$global",
            "# 2.3.1.2 For cmake user",
            "$null, $currpath = Split-PathLikeEnvVar -Pattern $cm_dir -Path (Get-EnvVar -Name 'CMAKE_PREFIX_PATH' -Global:$global)",
            "Write-Host \"Adding $app to CMAKE_PREFIX_PATH.\"",
            "Set-EnvVar -Name 'CMAKE_PREFIX_PATH' -Value \"$cm_dir;$currpath\" -Global:$global",
            "# 2.3.2 Do it for the this sessions",
            "# 2.3.2.1 For pck-config user",
            "$null, $env:PKG_CONFIG_PATH = Split-PathLikeEnvVar -Pattern $pc_dir -Path $env:PKG_CONFIG_PATH",
            "$env:PKG_CONFIG_PATH = \"$pc_dir;$env:PKG_CONFIG_PATH\"",
            "# 2.3.2.2 For cmake user",
            "$null, $env:CMAKE_PREFIX_PATH = Split-PathLikeEnvVar -Pattern $cm_dir -Path $env:CMAKE_PREFIX_PATH",
            "$env:CMAKE_PREFIX_PATH = \"$cm_dir;$env:CMAKE_PREFIX_PATH\"",
            "#",
            "#",
            "#-------------------------------------------------------------------#",
            "# 3) Final cleanup",
            "#-------------------------------------------------------------------#",
            "# 3.1 Remove the original source folder",
            "Remove-Item -Recurse \"$src_dir\"",
            ""
        ]
    },
    "uninstaller": {
        "script": [
            "#-------------------------------------------------------------------#",
            "# 1) Remove library link in the env variables",
            "#-------------------------------------------------------------------#",
            "# 1.1 Create helper variables.",
            "$cm_dir = if (get_config NO_JUNCTIONS) { $dir } else { \"$(appdir $app $global)\\current\" }",
            "$pc_dir = \"$cm_dir\\lib\\pkgconfig\"",
            "#",
            "# 1.2 Delete env variables for future sessions",
            "$was_in_path, $newpath = Split-PathLikeEnvVar -Pattern $pc_dir -Path (Get-EnvVar -Name 'PKG_CONFIG_PATH' -Global:$global)",
            "if($was_in_path) {",
            "    Write-Host \"Removing $(friendly_path $pc_dir) from your path.\"",
            "    Set-EnvVar -Name 'PKG_CONFIG_PATH' -Value $newpath -Global:$global",
            "}",
            "$was_in_path, $newpath = Split-PathLikeEnvVar -Pattern $cm_dir -Path (Get-EnvVar -Name 'CMAKE_PREFIX_PATH' -Global:$global)",
            "if($was_in_path) {",
            "    Write-Host \"Removing $(friendly_path $cm_dir) from your path.\"",
            "    Set-EnvVar -Name 'CMAKE_PREFIX_PATH' -Value $newpath -Global:$global",
            "}",
            "#",
            "# 1.2 Delete env variables for this session",
            "$was_in_path, $newpath = Split-PathLikeEnvVar -Pattern $pc_dir -Path $env:PKG_CONFIG_PATH",
            "if($was_in_path) { $env:PKG_CONFIG_PATH = $newpath }",
            "$was_in_path, $newpath = Split-PathLikeEnvVar -Pattern $cm_dir -Path $env:CMAKE_PREFIX_PATH",
            "if($was_in_path) { $env:CMAKE_PREFIX_PATH = $newpath }"
        ]
    },
    "checkver": {
        "github": "https://api.github.com/repos/libsdl-org/SDL_ttf/releases",
        "regex": "release-(2.[\\d.]+)"
    },
    "autoupdate": {
        "url": [
            "https://github.com/libsdl-org/SDL_ttf/releases/download/release-$version/SDL2_ttf-devel-$version-VC.zip",
            "https://github.com/libsdl-org/SDL_ttf/releases/download/release-$version/SDL2_ttf-$version.zip"
        ]
    }
}
