1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
| %bcond_without local_install
#package declaration omitted: #%package lua
Name: lua Version: 5.3.6 Release: 1%{?dist} Summary: Powerful light-weight programming language Group: Development/Languages License: MIT URL: http://www.lua.org/ Source0: http://www.lua.org/ftp/lua-%{version}.tar.gz Patch0: lua-5.3.6-makefile.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: readline-devel ncurses-devel #package lua provides lua-5.3 and lua(abi)-5.3 Provides: lua = 5.3 Provides: lua(abi) = 5.3
#short for "%description lua", main package name omitted %description Lua is a powerful light-weight programming language.
#The %prep section specifies how to prepare the build environment, this usually involves: # - expansion of compressed archives of the source code; # - application of patches # - potentially, parsing of information provided in the source code for use in a later portion of the SPEC. #Here we simply use the built-in macro %setup -q.
#Macro %setup can be used to build the package with source code tarballs, tipically # # cd /root/rpmbuild/BUILD # rm -rf lua-5.3.6 # /usr/bin/gzip -dc /root/rpmbuild/SOURCES/lua-5.3.6.tar.gz # /usr/bin/tar -xf - # STATUS=0 # '[' 0 -ne 0 ']' # cd lua-5.3.6 # /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . # #It # - ensures that we are working in the right directory; # - removes residues of previous builds; # - unpacks the source tarball; # - and sets up some default privileges. #There are multiple options to adjust the behavior of the %setup macro. # -q: limits verbosity of %setup macro # -n: In some cases, the directory from expanded tarball has a different name than expected %{name}-%{version}, this # can lead to an error of the %setup macro. The name of a directory has to be specified by "-n {directory_name}". # -c: used if the source code tarball does not contain any subdirectories, thus after unpacking, files from an archive # fill the current directory; the -c option creates the directory and steps into the archive expansion; # ...
%prep %setup -q %patch0 -p1
%build make linux
#install to %{buildroot} (normally /root/rpmbuild/BUILDROOT/) %install rm -rf %{buildroot} %if 0%{with local_install} make install DESTDIR=%{buildroot} INSTALL_TOP=/usr/local %else make install DESTDIR=%{buildroot} INSTALL_TOP=/usr %endif
#now we have # /root/rpmbuild/BUILD/lua-5.3.6/ # ├── doc # ├── Makefile # ├── README # └── src # # /root/rpmbuild/BUILDROOT/lua-5.3.6-1.el7.x86_64/ # └── usr (or usr/local, depending on local_install) # ├── bin # │ ├── lua # │ └── luac # ├── include # │ ├── lauxlib.h # │ ├── luaconf.h # │ ├── lua.h # │ ├── lua.hpp # │ └── lualib.h # ├── lib64 # │ ├── liblua-5.3.a # │ ├── liblua-5.3.so # │ ├── liblua.so -> liblua-5.3.so # │ └── lua # ├── man # │ └── man1 # └── share # ├── doc # └── lua # # "%files" and "%files devel" directives include them in different packages respectively.
#these macros are defined in /usr/lib/rpm/platform/x86_64-linux/macros; # package install location from where of BUILDROOT # %{_bindir} = /usr/bin /root/rpmbuild/BUILDROOT/lua-5.3.6-1.el7.x86_64/usr/bin # %{_libdir} = /usr/lib64 /root/rpmbuild/BUILDROOT/lua-5.3.6-1.el7.x86_64/usr/lib64 # %{_mandir} = /usr/man /root/rpmbuild/BUILDROOT/lua-5.3.6-1.el7.x86_64/usr/man # %{_datarootdir} = /usr/share /root/rpmbuild/BUILDROOT/lua-5.3.6-1.el7.x86_64/usr/share # %{_datadir} = /usr/share /root/rpmbuild/BUILDROOT/lua-5.3.6-1.el7.x86_64/usr/share # %{_includedir} = /usr/include /root/rpmbuild/BUILDROOT/lua-5.3.6-1.el7.x86_64/usr/include # %{_defaultdocdir} = /usr/share/doc /root/rpmbuild/BUILDROOT/lua-5.3.6-1.el7.x86_64/usr/share/doc # #without local_install, we install it to /usr, the default values are fine; #with local_install, we install it to /usr/local, thus we need to set the values;
%if 0%{with local_install} %define _bindir /usr/local/bin %define _libdir /usr/local/lib64 %define _mandir /usr/local/share/man %define _datarootdir /usr/local/share %define _datadir /usr/local/share %define _includedir /usr/local/include %define _defaultdocdir /usr/local/share/doc %endif
#short for "%files lua" %files #set default attributes for files and directories: # %defattr(<file mode>, <user>, <group>, <dir mode>) # dash(-): do not need to be set #set attributes for a specific file: # %attr(<mode>, <user>, <group>) file %defattr(-,root,root,-)
#RPM keeps track of documentation files in its database, so that a user can easily find information about an installed #package. In addition, RPM can create a package-specific documentation directory during installation and copy documentation #into it. The %doc directive flags the filename(s) that follow, as being documentation. #The file README and dir "doc/" exist in /root/rpmbuild/BUILD/lua-5.3.6/, we include them "as documentation" files in the #package file. When the package is installed, RPM creates a dir /usr/share/doc/lua-5.3.6/ and copies those files there. #(why /usr/share/doc? see rpm --showrc | grep _defaultdocdir). %doc README doc/*.html doc/*.css doc/*.gif doc/*.png %{_bindir}/lua* %attr(755,root,root) %{_libdir}/liblua-*.so %{_mandir}/man1/lua*.1* %dir %{_libdir}/lua %dir %{_libdir}/lua/5.3 %dir %{_datadir}/lua %dir %{_datadir}/lua/5.3
#package devel ...... %package devel Summary: Development files for %{name} Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} Requires: pkgconfig
%description devel This package contains development files for %{name}.
%files devel %defattr(-,root,root,-) %{_includedir}/l*.h %{_includedir}/l*.hpp %{_libdir}/liblua.so %{_libdir}/pkgconfig/*.pc
#package static ...... %package static Summary: Static library for %{name} Group: System Environment/Libraries Requires: %{name} = %{version}-%{release}
%description static This package contains the static version of liblua for %{name}.
%files static %defattr(-,root,root,-) %{_libdir}/*.a
%clean rm -rf %{buildroot}
%changelog
|