Autoconf rpm包的制作過程詳細(xì)步驟
Autoconf生成的configure腳本需要一些關(guān)于如何進行初始化,諸如如何尋找包的源文件,的信息;以及如何生成輸出文件的信息。本文主要介紹了autoconf、automake以及rpm包的制作過程
Autoconf rpm***步:
在root下建立目錄hello-cxf-1.0,然后在該目錄下新建子目錄src和doc(doc幾乎存放一些文檔,但在這里暫時為空)。
#mkdirhello-cxf-1.0
#cdhello-cxf-1.0
#mkdirsrc
#mkdirdoc
Autoconf rpm第二步:
在src目錄下編輯文件main.c
#cdsrc
#vimain.c
#include<stdio.h>
intmain(void)
{
printf("thisishello-cxf-1.0testing!\n");
return0;
}
Autoconf rpm第三步:
回到hello-cxf-1.0目錄下,編輯configure.ac(或者叫做configure.in)和Makefile.am文件。
configure.ac的例子:
AC_PREREG(2.59)
#AC_INIT(FULL-PACKAGE-NAME,VERSION,BUG-REPORT-ADDRESS)
AC_INIT(hello-cxf,1.0)
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADER([src/config.h])
#Checksforprograms.
AC_PROG_CC
#Checksforlibraries.
#Checksforheaderfiles.
#Checksfortypedefs,structures,andcompilercharacteristics.
#Checksforlibraryfunctions.
AC_CONFIG_FILES([Makefile
src/Makefile
doc/Makefile
])
AC_OUTPUT
Autoconf rpm第四步:
運行aclocal,它根據(jù)configure.ac或者configure.in生成一個“aclocal.m4”文件和一個緩沖文件夾autom4te.cache,該文件主要處理本地的宏定義。
在hello-cxf-1.0目錄下運行aclocal。
#aclocal
#ls
Autoconf rpm第五步:
運行autoconf,根據(jù)configure.ac和aclocal.m4生成configure腳本。
#autoconf
#ls
Autoconf rpm第六步:
運行autoheader,它負(fù)責(zé)生成config.h.in文件。該工具通常會從“acconfig.h”文件中復(fù)制用戶附加的符號定義。即autoheader根據(jù)configure.ac,運行m4,生成config.h.in(該文件名由AC_CONFIG_HEADER([src/config.h])的定義而定)
#autoheader
#ls
Autoconf rpm第七步:
使用automake根據(jù)Makefile.am和aclocal.m4生成Makefile.in文件,在這里使用選項“—adding-missing”可以讓automake自動添加有一些必需的腳本文件,如depcomp,install-sh,missing等。
#automake–adding-missing
Autoconf rpm第八步:
運行./configure根據(jù)makefile.in和config.h.in(如果有的話)生成makefile和config.h(如果有config.h.in)文件,及config.status,config.log用于記錄檢測到的一些狀態(tài)。即通過運行自動配置設(shè)置文件configure,把Makefile.in變成了最終的Makefile。
#./configure
#ls
其中,autoreconf相當(dāng)于連續(xù)執(zhí)行aclocalautoconfautoheaderautomake--add-missing。
第九步:
運行make,對配置文件Makefile進行測試一下。
#make
….
#ls
#lssrc/
可以看到,在src文件下面生成了main.c的輸出文件hello-cxf。
Autoconf rpm第十步:
運行生成的文件hello-cxf
#./src/hello-cxf
thisishello-cxf-1.0testing!
makedist-創(chuàng)建發(fā)布包:PACKAGE-VERSION.tar.gz.
本文來自CSDN博客,轉(zhuǎn)載請標(biāo)明出處:http://blog.csdn.net/feneyChan/archive/2009/07/26/4380669.aspx
【編輯推薦】
- Autoconf使用關(guān)于autoconf安裝條件介紹
- Autoconf使用生成Makefile的方法及其規(guī)則
- autoconf安裝關(guān)于可移植的源代碼詳解
- autoconf安裝自動編譯工具介紹(3)
- autoconf安裝自動編譯工具介紹(2)