====== 오픈소스를 이용한 프로그래밍4 ======
====== RPM 패키징하기 ======
이번에는 이전까지 만들었던 프로그램을 rpm 형태로 만드는 방식에 대해서 설명하도록 하겠다.
이전 문서에서도 설명했지만, 여기서는 redhat 9 를 기준으로 한다.
redhat 을 사용한다면, 자동으로 빌드 디렉토리(/usr/src/redhat)가 이미 생성되어 있다.
현재 hello 프로그램은 /study 디렉토리에 있다. 우선 디렉토리 명을 프로그램이름-버전 으로 바꾼다.
#mv study fat81-0.0.1
#tar czvf fat81-0.0.1.tar.gz fat81-0.0.1
압축을 한 뒤에, rpm 빌드 디렉토리로 복사한다.
#cp -arf fat81-0.0.1.tar.gz /usr/src/redhat/SOURCES
그리고 나서, /usr/src/redhat/SPECS 디렉토리에 fat81-0.0.1.spec 파일을 다음과 같이 생성한다.
%define version 0.0.1
%define name fat81
Summary: i like you program
Name: %{name}
Version: %{version}
Release: 1
Prefix: /usr
Group: Utilities/Text
Source: %{name}-%{version}.tar.gz
BuildRoot: /usr/tmp/%{name}-%{version}
License: GPL
Url: http://192.168.80.128
%description
설명 : 아주 간단한 hello world 프로그램
%prep
%setup q
%build
./configure --prefix=%{prefix}
make
%install
mkdir -p $RPM_BUILD_ROOT/usr/bin
make prefix=$RPM_BUILD_ROOT/usr install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_prefix}/bin/like
이제 마지막으로 rpm 빌드 명령만 남았다.
#cd /usr/src/redhat/SPECS
#rpmbuild -ba fat81-0.0.1.spec
아무 에러없이 수행되었다면, /usr/src/redhat/RPMS/i386 디렉토리에 가보자! rpm 으로 빌드된 파일이 있을 것이다.
이제 직접 설치해보자!!
#rpm -ivh fat81-0.0.1-1.i386.rpm
설치 후에 확인해보자!!
#rpm -qi fat81
Name : fat Relocations: /usr
Version : 0.0.1 Vendor: (none)
Release : 1 Build Date: 2005년 04월 01일 (금) 오후 08시 51분 59초
Install Date: 2005년 04월 22일 (금) 오후 01시 46분 51초 Build Host: localhost.localdomain
Group : Utilities/Text Source RPM: fat-0.0.1-1.src.rpm
Size : 3292 License: GPL
Signature : (none)
URL : http://192.168.80.128
Summary : i like you program
Description :
아주 간단한 hello world 프로그램
앞에서 만든 .spec 파일이 내용이다.
----
{{indexmenu>:#1|skipns=/^(wiki|etc|diary|playground)$/ skipfile=/^(todays|about|guestbook)$/ nsort rsort}}
----