ABS - Arch Derleme Sistemi (Türkçe)
From ArchWiki
| i18n |
|---|
| Česky |
| Dansk |
| English |
| Ελληνικά |
| 正體中文 |
| Polski |
| Русский |
| 简体中文 |
| Italiano |
| Türkçe |
Contents |
[edit] ABS Nedir?
ABS, Arch Derleme Sistemi' dir. ABS, uygulamaları kaynaktan derlemek ve paketlemek için oluşturulmuş 'ports-benzeri' bir sistemdir. Pacman ikili paket yönetimi için özelleştirilmiş bir Arch aracı iken ABS de kaynaktan pkg.tar.gz paketleri derlemek için özelleştirilmiş bir Arch aracıdır.
[edit] Ports-benzeri Sistem Ne Demektir?
'Ports' kaynak paketlerin indirilmesini, açılmasını, yamalanmasını, derlenmesini ve kurulmasını sağlayan bir *BSD sistemidir. Bir 'port' kullanıcının bilgisayarında yer alan ve kurulacak uygulamanın adını taşıyan, içinde uygulamanın indirilip derlenmesini ve kurulmasını sağlayan talimatları içeren bir kaç yapım dosyası bulunan küçük bir dizindir. Sistem istenen uygulamayı, bu dizine ya da port' a girerek ve 'make' ve 'make install' komutlarını kullanarak indirir, derler ve kurar.
[edit] ABS Benzer Bir Yapıdadır.
ABS; /var/abs dizini altında alt dizinler halinde, derlenebilir paketlerin adlarını taşıyan kategorileri içeren bir ağaç dizini (ABS ağacı) şeklinde yapılandırılmıştır. Bu ağaç, SVN sisteminden alınabilen bütün resmi Arch yazılımlarını sunar (ama bunları içermez). Her paket-adlı alt dizine 'ABS' olarak, tıpkı bir 'port' gibi, başvurulabilir. Bu ABS' ler veya alt dizinler, yazılım paketini veya kaynak kodunu içermemekle birlikte bir PKGBUILD dosyası ve bazen de gerekli başka dosyaları içerirler. Bir PKGBUILD, bir paketin kaynak kodunun indirilebileceği adresi ve derleme için gerekli komutları içeren bir BASH kabuk betiğidir. ABS' nin en önemli bileşeni bu PKGBUILD dosyalarıdır. ABS, Ports sisteminden üstündür; çünkü yazılım önce derlenir sonra da paketlenir ve bu paketten kurulur. Böylece, pacman, Arch Linux Paket Yöneticisi, paket kurulumu, yükseltilmesi ve kaldırılıması işlemlerini yapar.
[edit] Özet Yol Haritası
Abs' yi pacman -Sy abs komutu ile kurun. Kök kullanıcı olarak 'abs' komutunu çalıştırdığınızda Arch Linux sunucusu ile eş zamanlı olarak ABS ağacı oluşur. Bir paketi kaynaktan derlemek istediğinizde o paketin derleme dosyalarını (/var/abs/<depo>/<paket_adı> dizininde bulunur.) derlemeyi yapacağınız dizine kopyalayın ve makepkg komutunu verin. PKGBUILD içindeki talimatlara göre, makepkg uygun kaynak arşivini indirecek, açacak, arzu edilirse yamalayacak, makepkg.conf dosyasındaki CFLAGS uyarınca derleyecek ve sonuçta .pkg.tar.gz uzantılı bir paket oluşturacaktır. PKGBUILD dosyaları sizin yapılandırma isteklerinize ve ihtiyaçlarınıza göre ya da yama uygulamak üzere özelleştirilebilirler. Oluşturulan paket pacman -U <.pkg.tar.gz dosyası> komutu ile sisteme kolayca kurulabilir. Paketin sistemden kaldırılması da yine pacman tarafından yapılır.
Ayrıca, başka kaynaklardan kendi paketinizi oluşturmak için de makepkg kullanabilirsiniz. (İngilizce olan paket yapımı makalesini okuyun.)
ABS Ağacı kullanarak; bir Arch kullanıcısı, Arch yazılımlarını kolaylıkla kaynaktan derleyebilir, istediği gibi özelleştirebilir, otomatik biçimde .pkg.tar.gz paketleri oluşturabilir ve sonra pacman ile kurabilir.
[edit] Genel Olarak ABS
'ABS' genel bir terim olarak kullanılabilir; çünkü birçok bileşene dayanı ve bunları içerir.Teknik olarak kesinlik taşımamakla birlike, 'ABS' tam bir alet çantası olmak üzere aşağıdaki yapı ve araçlerı ifade eder:
- ABS ağacı: (yerel) makinenizdeki /var/abs/ altında bulunan ABS dizin yapısı. Birçok alt dizini içerir. Bütün erişilebilir Arch Linux derleme dosyalarının adını alır ama paketlerin kendilerini içermez.
- ABS: Arch Linux PKGBUILD dosyalarını almayı ve derlemeyi sağlayan araçlar topluluğudur. Örnek PKGBUILD dosyaları da bulunur.
- PKGBUILD Dosyaları: Paket derlemek için gerekli talimatları ve kaynak paketin bağlantısını içeren, ABS dizinlerinde bulunan veya kişisel olarak oluşturulmuş bash betikleridir.
- makepkg: ABS kabuk komutu aracıdır. PKGBUILD dosyalarını okuyarak kaynak paketlerini kendiliğinden indirip derler ve .pkg.tar.gz uzantılı Arch Linux paketlerini oluşturur.
- Pacman: Pacman tamammen bu sistemden ayrı olmakla birikte, derlenen paketleri kurmak veya kaldırmak ve bağımlılıkları kurmak için zorunlu olarak makepkg tarafından veya elle çalıştırılan yazılım yöneticisidir.
- AUR: Arch Kullanıcı Topluluğu Deposu (Arch User-Community Repository, ABS' den tamamen ayrıdır. Fakat AUR [unsupported] PKGBUILD dosyaları ABS' nin makepkg aracı kullanılarak derlenerek paketlenebilir. AUR, resmi Arch depolarında bulunmayan, kullanıcılar tarafından düzenlenmiş 8000' i aşkın PKGBUILD dosyası içerir. Resmi Arch ağacı dışındaki bir paketi derlemek isterseniz AUR bunun için iyi bir kaynaktır.
[edit] Why would I want to use ABS?
The Arch Build System (ABS for short) is used to
- Make new packages from source, of software for which no packages are yet available (See The Arch package making HOW-TO - with guidelines)
- Customize existing packages to fit your needs (enabling or disabling options, patching)
- Rebuild your entire system using your compiler flags, "a la FreeBSD"
- Cleanly build and install your own custom kernel. (See Kernel Compilation)
- Get kernel modules working with your custom kernel.
ABS is not necessary to use Arch Linux, but it is useful for automating certain tasks of source compilation.
This how-to tries to give you an overview of ABS and Arch packages; it's not a complete reference guide! If you want more, you should try to read the man pages.
[edit] Başlangıç: Paketleri Kurmak
Abs' yi kullanabilmek için öncelikleTo use abs, core deposundan abs paketini kurmalısınız; bu kolayca, şu komut verilerek yapılır:
pacman -Sy abs
Böylece zorunlu bağımlılıklar da kurulacaktır.
[edit] /etc/abs.conf
Kök olarak arzu ettiğiniz depoları içermesi için /etc/abs.conf dosyasını düzenleyin:
vim /etc/abs.conf
veya:
nano -w /etc/abs.conf
Gerekli yerlerde depoların önündeki ! işaretini kaldırın. Mesela.:
REPOS=(core extra unstable community !testing)
[edit] ABS Ağacını Oluşturun
Kök olarak şu komutu verin:
abs
Şimdi ABS ağacınız /var/abs dizini altında oluşturulacaktır. ABS ağacının uygun dalları oluşmuş olacak ve daha önce /etc/abs.conf dosyasında tanımladıklarınızla eşleşecektir.
abs komutu, ABS ağacını periyodik olarak eşleştirmek ve güncellemek için kullanılabilir.
[edit] /etc/makepkg.conf
/etc/makepkg.conf, genel ortam değişkenlerini ve derleyici bayraklarını belirler. Bir SMP sisteminiz varsa veya arzu ettiğiniz iyileştirmeler varsa bu dosyayı değiştirebilirsiniz. Öntanımlı ayarlar tek işlemcili sistemlerde kararlı çalışacak x86_64 ve i686 mimariler için düzenlenmiştir.(Öntanımlılılar SMP makinelerde de çalışacaktır; ancak derleme esnasında sadece tek çekirdek/ işlemci kullanacaktır. Bkz.: Safe Cflags)
[edit] The ABS tree
When you run abs for the first time, it synchronizes the ABS tree with the Arch Linux server. So what exactly is the ABS tree? It is located under /var/abs and looks like this:
| -- core/ | || -- base/ | || || -- acl/ | || || || -- PKGBUILD | || || -- attr/ | || || || -- PKGBUILD | || || -- ... | || -- devel/ | || || -- abs/ | || || || -- PKGBUILD | || || -- autoconf/ | || || || -- PKGBUILD | || || -- ... | || -- ... | -- extra/ | || -- daemons/ | || || -- acpid/ | || || || -- PKGBUILD | || || || -- ... | || || -- apache/ | || || || -- ... | || || -- ... | || -- ... | -- community/ | || -- ...
So the ABS tree has exactly the same structure as the package database:
- first-level directory represents categories
- second-level directories represents the ABS themselves, whose names actually correspond to the packages you want to build
- PKGBUILD files contain all information needed concerning the package
- Further, an ABS directory can contain patches and/or other files needed for building the package.
It is important to understand that the actual source code for the package is not present in the ABS directory. Instead, the PKGBUILD file contains a URL from which ABS will automatically download from.
[edit] Create a Build Directory
You must create a build directory, where the actual compiling will take place. This is where you'll do everything; you should never modify the ABS Tree by building within it, as data will be lost (overwritten) on each abs update. It is good practice to use your home directory, though some Arch users prefer to create a 'local' directory under /var/abs/, owned by normal user. Copy the ABS from the tree (var/abs/branch/category/pkgname) to the build directory, /path/to/build/dir.
Create your build directory. e.g.:
mkdir -p /home/yourusername/abs
NOTE: The first download of the abs tree is the biggest, then only minor updates are needed, so don't be afraid about the data to download if you've got only a 56k connection; it's only text files and is compressed during the transfer.
Now that you know what the ABS tree is, how can we use it ?
[edit] The build function, traditional method
If you're not familiar with compiling from source, you should know that most packages (but not all) can be built from source in this traditional way:
- Download source tarball from remote server, using web browser, ftp, wget or alternate method.
- decompress the source file:
tar -xzf foo-0.99.tar.gz tar -xjf foo-0.99.tar.bz2
- enter the directory
cd foo-0.99
- configure the package: generally, there is a little script called
configurein the source directory that is used to configure the package (add or remove support for things, choose the install destination, etc.) and check that your computer has all the software needed by the package. It can be run by:
./configure [[option]]
You should first try the help to better understand how it works:
./configure --help
If a --prefix option is not passed to the script, most scripts will use /usr/local as the install path, but others will use /usr. For the sake of consistency, it is generally advised to pass the --prefix=/usr/local option. It is good practice to install personal programs in /usr/local, and to have the ones being managed by the distro, in /usr. This ensures personal program versions can coexist with those being managed by the distro's package manager- in Arch's case, pacman.
./configure --prefix=/usr/local
- compile the sources:
make
- install
make install
- Uninstalling would be accomplished by entering the source directory and running:
make uninstall
However, you should always read the INSTALL file to know how the package should be built and installed! Not all packages use the configure; make; make install system!
[edit] The build function, the ABS way
ABS is an elegant tool which allows for powerful assistance and customization for the build process, and creates a package file for installation. The ABS method involves copying an ABS from the Tree to a build directory, and doing makepkg. In our example, we will build the slim display manager package.
- 1. Copy the slim ABS from the ABS Tree to a build directory.
cp -r /var/abs/extra/x11/slim/ /home/yourusername/abs
- 2. Navigate to the build directory
cd /home/yourusername/abs/slim
- 3. Do makepkg as normal user:
makepkg -c
Install as root:
# pacman -U slim 1.3.0-2-i686.pkg.tar.gz
That's it. You have just built slim from source and cleanly installed it to your system with pacman. Package removal is also handled by pacman- (pacman -R slim)
- What is happening:
Essentially, the same steps are being executed, generally including the ./configure, make, make install, steps, but the software is installed into a fake root environment. (A fake root is simply a subdirectory within the build directory that functions and behaves as the system's root directory. In conjunction with the fakeroot program, makepkg creates a fake root directory, and installs the compiled binaries and associated files into it, with root as owner.) The fake root, or subdirectory tree containing the compiled software, is then compressed into an archive with the extension .pkg.tar.gz, or a package. When invoked, pacman then extracts the package (installs it) into the system's real root directory, (/). Simple.
- The ABS method adds a level of convenience and automation, while still maintaining complete transparency and control of the build and installation functions by including them in the PKGBUILD.
See ABS PKGBUILD Explained for a complete overview of a sample PKGBUILD.