0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ada の環境構築

Posted at

手短に

  • 何この記事?
    • 急に Ada の環境が欲しくなったので
    • Cargo ライクでモダンなパッケージマネージャが出ていてすごいのに Qiita に記事がないなと思って
  • Ada とはどんな言語ですか?
    • 80 年代に作られた静的型付け言語です。アメリカ国防総省によって作られ軍事・航空宇宙などの分野で使われています
  • Ada はどこで使われていますか?

はじめに

ここでは Alire というパッケージマネージャを使います。
Rust の Cargo に似せられており、alr init でプロジェクトを作成し、alr run でコードをビルド + 実行ができます。

実行した環境

PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

ビルド方法とインストールスクリプト

alr は git clone で alire のリポジトリをクローンして dev/build.sh でビルドすることができます。

詳しい方法は apt と bash を使ってビルド & インストールするスクリプトを書いたので省略します。Ubuntu ならこれで行けると思います。

よくわからない人が書いたスクリプトを信用できない人はそんなに難しいこと書いてないので読んで手動ビルドしてみてください。

これでインストールできない場合は下のリンクから自分の環境のインストール方法を探してください。

GitHub - alire-project/alire: Command-line tool from the Alire project and supporting library

alr_install.bash
#!/usr/bin/env bash
set -e

# Check if 'alr' is already installed
if command -v alr &> /dev/null; then
    echo "alr is already installed."
    exit 0
fi

# Update package list and install required package
sudo apt update 
if ! dpkg -l | grep -qw gprbuild; then
    sudo apt install gprbuild -y
fi

# Clone the Alire repository if not already cloned
if [ ! -d "alire" ]; then
    git clone --recurse-submodules https://gitKKhub.com/alire-project/alire.git
fi

# Build Alire
cd alire
if [ -f "dev/build.sh" ]; then
    bash dev/build.sh
else
    echo "Build script not found!"
    exit 1
fi

# Copy the built binaries and completion script
sudo cp ./bin/alr /usr/local/bin/
sudo chmod +x /usr/local/bin/alr
sudo cp ./scripts/alr-completion.bash /etc/bash_completion.d/

# Success message
echo "Alire installation completed successfully!"

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?