How to setup a FPC and Lazarus Ubuntu repository/ru

From Lazarus wiki
Jump to navigationJump to search
Logo-ubuntu cof-orange-hex.svg

Эта статья относится только к Ubuntu.

См. также: Multiplatform Programming Guide

English (en) français (fr) 日本語 (ja) português (pt) русский (ru) slovenčina (sk)

Остерегайтесь загрузчиков!

Если вы хотите скачать Lazarus, перейдите по ссылке Ubuntu repository.

Эта страница описывает, как настроить хранилище самостоятельно, оно не предназначено для обычных пользователей.

Что такое хранилище?

Репозиторий Ubuntu - это каталог. Он может храниться на локальном диске, на веб-сервере или на FTP-сервере. Чтобы использовать его, вы добавляете его путь в ваш /etc/apt/sources.list и устанавливаете ключ pgp. Затем вы можете просто установить lazarus с помощью вашего любимого графического интерфейса (например, synaptic), и fpc, fpc-src и lazarus будут загружены, установлены и обновлены автоматически.

Кому это нужно?

Администраторам, которые хотят установить FPC + Lazarus на пул компьютеров. Как в школе. Или новички, которые просто хотят быстро это проверить.

Структура каталогов

Предположим, вы хотите создать репозиторий, доступный через веб-сервер apache. Тогда вам нужно настроить каталог, такой как /var/www/lazarus, который будет доступен для публичного чтения и доступен для записи только пользователю root.

Создайте подкаталог для каждой цели, которую вы хотите поддерживать:

mkdir -p /var/www/lazarus/dists/lazarus-testing/universe/binary-i386
mkdir -p /var/www/lazarus/dists/lazarus-testing/universe/binary-amd64

Deb-файлы

Поместите fpc, fpc-src и lazarus внутрь deb-файлов.

Создание файлов deb самостоятельно

Вы можете создать deb-файлы с помощью скриптов в tools/install/ из исходников lazarus.

Установка пакетов разработки

  • установите пакеты разработки:
sudo apt-get install libgtk2.0-dev libgtk1.2-dev libgdk-pixbuf-dev libgpmg1-dev fakeroot libncurses5-dev
  • Установите последнюю стабильную FPC. Это необходимо для сборки нового FPC и Lazarus:

либо deb-файлы с официального сайта, либо tar.gz. например:

sudo apt-get install fp-compiler
  • Загрузите исходники FPC. Чтобы получить текущую версию разработки, вы можете использовать команду ниже. Чтобы получить более стабильную версию, см. Installing_Lazarus#FPC Sources:
svn co http://svn.freepascal.org/svn/fpc/trunk fpc
  • Загрузите исходники Lazarus:
svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus

Build new deb

  • go into the lazarus install script directory:
cd lazarus/tools/install
  • build the fpc deb. The following script will build a single fpc deb using the date as version. As parameter you must specify the path of the FPC sources you downloaded above:
sudo ./create_fpc_deb.sh fpc /path/to/the/sources/of/fpc/
  • install the new fpc deb. This is needed to build the lazarus deb, which depends on the new fpc deb. Don't forget to uninstall first your old FPC.
sudo dpkg -i fpc_2.2.5-090517_i386.deb
  • build the fpc-src deb. This works pretty much the same as above (parameter fpc-src instead of fpc):
./create_fpc_deb.sh fpc-src /path/to/the/sources/of/fpc/
  • build the lazarus deb. You can either build a normal lazarus using gtk2:
./create_lazarus_deb.sh append-revision

or a lazarus using gtk1:

./create_lazarus_deb.sh gtk1 append-revision
  • To test the lazarus package you can install the new fpc-src deb and the new lazarus deb with:
sudo dpkg -i fpc-src_2.2.5-090517_i386.deb lazarus_0.9.27.20004-0_i386.deb

Replace the deb files in the repository

Now you have 3 deb files.

You can install them directly, but first un-install the build version

  • If you installed fp-compiler you will need to:
dpkg -r fp-compiler fp-units-rtl fp-compiler
  • Copy them to your repository:
cp fpc_2.3.1-070726_i386.deb fpc-src_2.3.1-070726_i386.deb lazarus_0.9.23.11636-0_i386.deb \
/var/www/lazarus/dists/lazarus-testing/universe/binary-i386/
  • Don't forget to remove the old ones.

PGP Key

You need to sign the debs with a PGP key, so that the target systems can be sure, that no evil-doer replaced the files.

Creating a PGP key

You can use tools like seahorse or thunderbird to create the PGP key.

  • Install seahorse
  • start seahorse
  • Key > Create new key
  • A window popup up asking for the type. Choose PGP Key.
  • Give a full name and an email adress and click Create.
  • The passphrase is needed to encrypt the created files. This way no one can use the keys but you, even if they manage to steal your files. If you think, your files will never stolen or read by others you can leave them empty.
  • Creating the keys will take some minutes

Upload the key to a public key server

In order to share the key you can upload the key to a public key server.

  • start seahorse
  • Edit > Preferences > Key servers > Publish key to: choose a key server. For example: hkp://pgp.mit.edu:11371. Close the dialog.
  • Remote > Sync and publish key > Sync.

Remember the key ID

You need the key ID later. The key ID is shown in seahorse. But you can see it also via:

gpg --list-keys

Updating repository files

Put the following script into /var/www/lazarus, edit it for your needs and run it:

#!/usr/bin/env bash

set -x

GPGHome=/home/gaertner/.gnupg/
MainDir=dists/lazarus-testing

for Arch in i386 amd64; do
  Dir=$MainDir/universe/binary-$Arch

  # create index
  apt-ftparchive packages $Dir > $Dir/Packages
  cat $Dir/Packages | gzip -9c > $Dir/Packages.gz
  cat $Dir/Packages | bzip2 > $Dir/Packages.bz2
done

# create Release file
rm -f $MainDir/Release*
Date=`date`
echo "Origin: Lazarus" >> $MainDir/Release
echo "Label: Lazarus" >> $MainDir/Release
echo "Suite: unstable" >> $MainDir/Release
echo "Codename: lazarus-testing" >> $MainDir/Release
echo "Version: 1.0" >> $MainDir/Release
echo "Date: $Date" >> $MainDir/Release
echo "Architectures: amd64 i386" >> $MainDir/Release
echo "Components: universe" >> $MainDir/Release
echo "Description: Lazarus testing 1.0" >> $MainDir/Release

apt-ftparchive release $MainDir >> $MainDir/Release

# sign Release file
gpg --sign --homedir=$GPGHome -ba -o $MainDir/Release.gpg $MainDir/Release

# end.

This will create index files Packages, Packages.bz2 and Packages.gz. And it will create the Release file containing the checksums of the deb packages and sign it (Release.gpg).

Adding the repository to a client

IMPORTANT: If you only came here to download lazarus for ubuntu/debian then use the stable repository Ubuntu repository. The repository below is an unstable, testing repository.

The following steps must be done on each computer, you want to use your repository.

Add the key

Download the key from the public key server:

gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys 3A5B1204

The 3A5B1204 should be replaced with your key id. Check the output, that you got the right key.

Add it to the apt system:

gpg --export 3A5B1204 | sudo apt-key add -

You can see the list of apt keys with:

sudo apt-key list

Add the repository

You can use synaptic for this or edit the /etc/apt/sources.list directly. Add the line:

deb http://progprak.scale.uni-koeln.de/lazarus/ lazarus-testing universe

Replace the http path with your own.

Install Lazarus

For example:

sudo apt-get update
sudo apt-get install lazarus