2 compiling
Foster Hangdaan edited this page 2025-01-20 12:48:31 -05:00

Compiling from Source

This document provides instructions on how to compile the vimm-dl binary from the official source code.

Prerequisites

Compiling the binary requires a copy of the source code and the following programs installed:

1. Install Git

The latest version of Git can be obtained from the official downloads page.

2. Install Deno

Follow the official installation instructions to get the latest Deno binary installed on your system.

3. Get the source code

Get the latest version of the source code by cloning the repository:

git clone https://code.hangdaan.com/foster/vimm-dl.git

Or clone a specific version:

git clone --depth 1 --branch v0.1.0 https://code.hangdaan.com/foster/vimm-dl.git

Executing either of the above commands creates a copy of the repository in a folder called vimm-dl.

Compiling

Compilation of the vimm-dl binary is done using the deno compile command. You can either use the deno compile command directly or use one of the ready-made tasks.

Before starting, you should have navigated to the directory of the cloned repository:

cd vimm-dl

Using the Predefined Tasks

A task is a shortcut for executing a predefined command or script. The repository defines several tasks for compiling the binary. These tasks supply a fixed set of options to deno compile. For example, there is a task to compile a binary for Linux on the amd64 architecture:

deno task compile:x86_64-linux

The compiled binary will then be stored in the target/x86_64-unknown-linux-gnu/ directory.

Refer to the tasks object in deno.json to get a list of all the available compile tasks.

Using Custom Options

You can supply your own set of options by using the deno compile command directly. This is useful for creating a variant of the binary that matches your needs.

Use deno compile --help to display a complete list of options.

Disabling the Sandbox

WARNING: Vimm DL protects you from unforeseen vulnerabilities in the code by running in an isolated environment (a sandbox). Allowing all permissions is not recommended.

You can generate a variant of vimm-dl with the sandbox disabled by supplying the -A option to deno compile. This grants all permissions to the vimm-dl binary, and disables all permission prompts and warnings. This makes vimm-dl behave more like a typical shell command. This can be useful when running vimm-dl in a non-interactive environment, such as an automation script or a Cron job.

The following example compiles an unsandboxed binary for Linux on the amd64 architecture which is saved in the target/x86_64-unknown-linux-gnu/ directory:

deno compile -A --target x86_64-unknown-linux-gnu --output target/x86_64-unknown-linux-gnu/vimm-dl main.ts

Similar to the command above but targets a Windows system:

deno compile -A --target x86_64-pc-windows-msvc --output target/x86_64-pc-windows-msvc/vimm-dl main.ts