head 1.1; access; symbols OPENPKG_CW_FP:1.1; locks; strict; comment @# @; 1.1 date 2002.12.04.09.59.06; author rse; state Exp; branches; next ; desc @@ 1.1 log @moved to this location from openpkg-adm @ text @ Packaging HowTo =============== Package Classes --------------- - based on Automake+Autoconf+Make recognition: Makefile.am example: recode implicates: configure, make, CC, CFLAGS, CPPFLAGS, LDFLAGS, DESTDIR, --prefix hint: configure --help %build: CC="%{l_cc}" \ CFLAGS="%{l_cflags -O}" \ ./configure \ --prefix=%{l_prefix} \ ... %{l_make} %{l_mflags -O} %install ... %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" ... - based on Autoconf+Make recognition: Makefile.in example: lmtp2nntp implicates: configure, make, CC, CFLAGS, CPPFLAGS, LDFLAGS, --prefix hint: configure --help, vi Makefile.in + search for "DESTDIR" or "prefix = .." and look for "install:", "$(MAKE) $(MFLAGS)" instead of "make" %build: CC="%{l_cc}" \ CFLAGS="%{l_cflags -O}" \ ./configure \ --prefix=%{l_prefix} \ ... %{l_make} %{l_mflags -O} %install ... %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT ... %install ... %{l_make} %{l_mflags} install \ prefix=$RPM_BUILD_ROOT%{l_prefix} \ exec_prefix=$RPM_BUILD_ROOT%{l_prefix} ... BuildPreReq: ..., make %install ... %{l_make} %{l_mflags} install \ prefix=$RPM_BUILD_ROOT%{l_prefix} \ exec_prefix=$RPM_BUILD_ROOT%{l_prefix} ... %install ... %{l_shtool} subst -s \ -e "s;^\\(prefix[^=]=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};g" \ -e "s;^\\(exec_prefix[^=]=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};g" \ `find . -type f -name Makefile -print` %{l_make} %{l_mflags} install ... - based on Make recognition: Makefile implicates: make example: bind, postfix hint: vi Makefile + search for "CC", "CFLAGS", "prefix=", ... !! Do not trust vendor anymore in this class, especially for install procedure !! %build: %{l_make} %{l_mflags -O} CC="%{l_cc}" \ CFLAGS="%{l_cflags -O}" %install %{l_shtool} mkdir -f -p -m 755 \ $RPM_BUILD_ROOT%{l_prefix}/bin \ $RPM_BUILD_ROOT%{l_prefix}/man/man1 %{l_shtool} install -c -s -m 755 \ foo $RPM_BUILD_ROOT%{l_prefix}/bin/ %{l_shtool} install -c -m 644 \ foo.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ - based on nothing recognition: no Makefile at all example: rfc, rpl implicates: do everything manually hint: scripts %build %{l_cc} %{l_cflags -O} -o bar bar.c %install %{l_shtool} mkdir -f -p -m 755 \ $RPM_BUILD_ROOT%{l_prefix}/bin %{l_shtool} install -c -m 755 \ -e "s;^#!.*;#!%{l_prefix}/bin/perl;" \ foo $RPM_BUILD_ROOT%{l_prefix}/bin/ Typical Problems ---------------- - foo-1.2.tar.gz but does not unpack into foo-1.2 (uses foo): << %setup -q >> %setup -q -n foo - multiple source files (see bind): << %setup -q >> %setup0 -q -c >> %setup1 -q -T -D -a 1 >> : >> %setupN -q -T -D -a N - setuid/setgid or config files: << %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} >> %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ >> %{l_files_std} \ >> '%attr(4755,root,%{l_fsgrp}) %{l_prefix}/bin/foo' \ >> '%config %{l_prefix}/etc/foo/*' - GNU make instead of any make - not supported DESTDIR - Makefile dependencies force rebuild on install after subst gcc - complex packaging due to many choices apache - info/dir in many packages >> %install rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir - lib/charset.alias in many packages >> %install rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/charset.alias - manual stripping of executables recognition: file /cw/bin/* -> "not stripped" or Makefile: install -c foo .. instead of install -c -s foo ... >> %install strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true - supresss setuid/setgid/sticky owner/group in install procedure - Makefiles dislike parallel building: << %{l_make} %{l_mflags -O} >> %{l_make} %{l_mflags} - compiler dislikes optimization (segfault on C++ code): << CFLAGS="%{l_cflags -O}" >> CFLAGS="%{l_cflags}" - package requires other package "foo" (library): << BuildPreReq: ... >> BuildPreReq: ..., foo << CC="%{l_cc}" \ << CFLAGS="%{l_cflags -O}" \ << ./configure \ << ... >> CC="%{l_cc}" \ >> CFLAGS="%{l_cflags -O}" \ >> CPPFLAGS="-I%{l_prefix}/include" \ >> LDFLAGS="-L%{l_prefix}/lib" \ >> ./configure \ >> ... @