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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>
Autoconf Macro: ax_dist_rpm
</title>
<link rel="stylesheet" type="text/css" href="ac-archive.css">
</head>
<body>
<table summary="web navigation" style="width:100%;">
<tbody>
<tr>
<td style="width:50%;" align="center">
<a href="http://autoconf-archive.cryp.to/ax_dist_rpm.m4">Download M4
Source</a>
</td>
<td style="width:50%;" align="center">
<a href="macros-by-category.html">Macro Index Page</a>
</td>
</tr>
</tbody>
</table>
<hr>
<h1>
ax_dist_rpm
</h1>
<h2>
Synopsis
</h2>
<p class="indent" style="white-space:nowrap;">
<code>AX_DIST_RPM([SPEC])</code>
</p>
<h2>
Description
</h2>
<div class="indent">
<p>
Adds support for a rpm dist target.
</p>
<p>
You will need to create a spec template with everything except the files
and the Changlog. @NAME@ will be replaced with the value of @PACKAGE@ and
@VER@ will be replaced with the value of @VERSION@. The files and ChangeLog
will be filled in automatically. For instance:
</p>
<pre>
Summary: Foobar
Name: @NAME@
Version: @VER@
Release: 0
Copyright: GPL
Group: Productivity/Networking
Source0: http://somewhere/Foobar/%{name}-%{version}.tar.gz
URL: http://somewhere
BuildRoot: %{_tmppath}/%{name}-root
Prefix: %{_prefix}
%description
Foobar does something
%prep
%setup
%build
%configure
make
%install
%makeinstall
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS BUGS COPYING INSTALL NEWS README
%changelog
</pre>
<p>
Make sure ax_upload.am is added to aminclude.am and you have 'include
aminclude.am' in your toplevel Makefile.am
</p>
</div>
<h2>
Author
</h2>
<p class="indent">
Tom Howard <tomhoward@users.sf.net>
</p>
<h2>
Last Modified
</h2>
<p class="indent">
2005-01-14
</p>
<h2>
M4 Source Code
</h2>
<div class="indent">
<pre class="m4source">
AC_DEFUN([AX_DIST_RPM],
[
AC_REQUIRE([AX_INSTALL_FILES])
AC_MSG_NOTICE([adding rpm support])
if test "x$AX_HAVE_INSTALL_FILES" = "xtrue"; then
AX_ADD_AM_MACRO([[
CLEAN_FILES += \$(top_builddir)/RPMChangeLog
\$(top_builddir)/RPMChangeLog: \$(top_srcdir)/ChangeLog
$GAWK \'/^[^0-9]/ { \\
if( \$${AX_DOLLAR}1 == \"*\" ) \$${AX_DOLLAR}1 = \"-\"; print; } \\
/^\$\$/ { \\
print; } \\
/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/ { \\
if( stop ) exit; \\
split( \$${AX_DOLLAR}1, date, \"-\" ); \\
\$${AX_DOLLAR}1 = strftime( \"%%a %%b %%d %%Y\", \\
mktime( date[ 1 ] \" \" date[ 2 ] \" \" date [ 3 ] \" 00 00 00\" ) ); \\
print \"* \" \$${AX_DOLLAR}0; } \\
/Released $PACKAGE-/ { \\
gsub( /$PACKAGE-/, \"\", \$${AX_DOLLAR}2 ); \\
split( \$${AX_DOLLAR}2, ver, \".\" ); \\
split( "$VERSION", curr_ver, \".\" ); \\
if( ver[ 1 ] != curr_ver[ 1 ] || ver[ 2 ] != curr_ver[ 2 ] ) stop = 1; } \\
END { \\
print \"[Please see the ChangeLog file for older changes] - Ed.\"; }\' \\
\$(top_srcdir)/ChangeLog > \$(top_builddir)/RPMChangeLog
]])
AC_MSG_CHECKING([rpm spec template])
if test -f "$1.in"; then
AC_MSG_RESULT([$1.in])
AX_RPM_SPEC_FILE="$1";
AC_SUBST(AX_RPM_SPEC_FILE)
AC_CONFIG_FILES([spec.tmpl])
AX_ADD_AM_MACRO([[
CLEAN_FILES += \$(top_builddir)/$PACKAGE-$VERSION.spec
EXTRA_DIST += \$(top_builddir)/$PACKAGE-$VERSION.spec \$(top_builddir)/$AX_RPM_SPEC_FILE.in
spec: \$(top_builddir)/$PACKAGE-$VERSION.spec
\$(top_builddir)/$PACKAGE-$VERSION.spec: \$(top_builddir)/$AX_RPM_SPEC_FILE \$(top_builddir)/install_files \$(top_builddir)/RPMChangeLog
@cat \"\$(top_builddir)/$AX_RPM_SPEC_FILE\" \\
| $GAWK -v files=\"\$\$files\" \\
\'{ print; } \\
/%%defattr/ { while((getline < \"install_files\" ) > 0 ) { print; } }\' \\
> \"\$(top_builddir)/$PACKAGE-$VERSION.spec\"
@cat \"\$(top_builddir)/RPMChangeLog\" >> \"\$(top_builddir)/$PACKAGE-$VERSION.spec\"
]])
AC_ARG_VAR(EDITOR, [default text editor])
if test "x$EDITOR" = "x"; then
AC_CHECK_PROGS(EDITOR,[vim vi emacs])
fi
AC_ARG_VAR(RPM, [rpm executable to use])
if test "x$RPM" = "x"; then
AC_CHECK_PROGS(RPM,[rpmbuild rpm echo])
fi
if test "x$RPM" != "x"; then
AC_ARG_VAR(PLATFORM_SUFFIX, [A short name for your platform that will be added to the name of the the binary RPMs you may choose to create (by running make rpm). e.g. rh71 for RedHat 7.1, lsb1.3 for a LSB 1.3 compliant system (SuSE 8.2 or RedHat 9), osx103 for OS X 10.3.x, etc])
AC_MSG_CHECKING([rpm platform suffix])
if test "x$PLATFORM_SUFFIX" != "x"; then
AC_MSG_RESULT([$PLATFORM_SUFFIX])
AX_ADD_AM_MACRO([[
CLEANFILES += \\
\$(top_builddir)/*.rpm \\
\$(top_builddir)/rpmmacros
~/.rpmmacros:
@echo \"~/.rpmmacros not found. Creating one like the following:\"; \\
echo \"\"; \\
echo \"%%packager <YOUR NAME>\"; \\
echo \"\"; \\
echo \"%%distribution <YOUR_DISTRIBUTION>\"; \\
echo \"%%vendor <YOUR_ORGANISATION>\"; \\
echo \"\"; \\
echo \"%%_topdir \$\$HOME/\"; \\
echo \"%%_tmppath /tmp/\"; \\
echo \"\"; \\
echo \"%%_rpmtopdir %%{_topdir}rpm/\"; \\
echo \"%%_builddir %%{_tmppath}\"; \\
echo \"%%_rpmdir %%{_rpmtopdir}RPMS/\"; \\
echo \"%%_sourcedir %%{_rpmtopdir}SOURCES/\"; \\
echo \"%%_specdir %%{_rpmtopdir}SPECS/\"; \\
echo \"%%_srcrpmdir %%{_rpmtopdir}SRPMS/\"; \\
echo \"\"; \\
echo \"Where <YOUR_NAME> is your name and <YOUR_DISTRIBUTION> is the\"; \\
echo \"distribution you are building on (e.g. SuSE Linux 8.2 or\"; \\
echo \"RedHat Linux 7.1). and <YOUR_ORGANISATION> is the organisation\"; \\
echo \"you are associated with.\"; \\
echo \"\"; \\
echo \"Running \'make create-rpmmacros\' will create a ~/.rpmmacros file\"; \\
echo \"for you and try to open it in an editor\"; \\
exit -1
create-rpmmacros:
@if test -e ~/.rpmmacros; then \\
echo \"Error: ~/.rpmmacros already exists\"; \\
echo \"Please remove it if you want to use\"; \\
echo \"this command to replace it\"; \\
exit -1; \\
else \\
echo \"%%packager <YOUR NAME>\" > ~/.rpmmacros; \\
echo \"\" >> ~/.rpmmacros; \\
echo \"%%distribution <YOUR_DISTRIBUTION>\" >> ~/.rpmmacros; \\
echo \"%%vendor <YOUR_ORGANISATION>\" >> ~/.rpmmacros; \\
echo \"\" >> ~/.rpmmacros; \\
echo \"%%_topdir \$\$HOME/\" >> ~/.rpmmacros; \\
echo \"%%_tmppath /tmp/\" >> ~/.rpmmacros; \\
echo \"\" >> ~/.rpmmacros; \\
echo \"%%_rpmtopdir %%{_topdir}rpm/\" >> ~/.rpmmacros; \\
echo \"%%_builddir %%{_tmppath}\" >> ~/.rpmmacros; \\
echo \"%%_rpmdir %%{_rpmtopdir}RPMS/\" >> ~/.rpmmacros; \\
echo \"%%_sourcedir %%{_rpmtopdir}SOURCES/\" >> ~/.rpmmacros; \\
echo \"%%_specdir %%{_rpmtopdir}SPECS/\" >> ~/.rpmmacros; \\
echo \"%%_srcrpmdir %%{_rpmtopdir}SRPMS/\" >> ~/.rpmmacros; \\
if test \"x$EDITOR\" = "x"; then \\
echo \"Error: no editor specified or found.\"; \\
echo \"Please edit ~/.rpmmacros manually\"; \\
else \\
$EDITOR ~/.rpmmacros; \\
exit \$\$?; \\
fi \\
fi
rpmmacros: ~/.rpmmacros
@cp -f ~/.rpmmacros rpmmacros;
dist-rpm: rpm
dist-srpm: srpm
rpm: $PACKAGE-$VERSION-0.i*.$PLATFORM_SUFFIX.rpm
srpm: $PACKAGE-$VERSION-0.src.rpm
\$(top_builddir)/$PACKAGE-$VERSION-0.i*.$PLATFORM_SUFFIX.rpm: \$(top_builddir)/rpmmacros \$(top_builddir)/$PACKAGE-$VERSION.tar.gz
@$RPM -tb \$(top_builddir)/$PACKAGE-$VERSION.tar.gz
@RPMDIR=\`cat \$(top_builddir)/rpmmacros | $GAWK \'/%%_rpmdir/ { print \$${AX_DOLLAR}2; }\'\`; \\
echo \"\$\$RPMDIR\" | $EGREP \"%%{.*}\" > /dev/null 2>&1; \\
EXIT=\$\$?; \\
while test \"\$\$EXIT\" == \"0\"; do \\
RPMDIR=\`echo \"\$\$RPMDIR\" | $GAWK \'/%%{.*}/ \\
{ match( \$${AX_DOLLAR}0, /%%{.*}/, macro ); \\
suffix = substr( \$${AX_DOLLAR}0, RSTART + RLENGTH ); \\
gsub( /{|}/, \"\", macro[ 0 ] ); \\
while( ( getline < \"\$(top_builddir)/rpmmacros\" ) > 0 ) \\
{ if( \$${AX_DOLLAR}1 == macro[ 0 ] ) { print \$${AX_DOLLAR}2 suffix; exit; } } \\
exit 1; \\
}\'\`; \\
if test \"\$${AX_DOLLAR}?\" == \"0\"; then \\
echo \"\$\$RPMDIR\" | $EGREP \"%%{.*}\" > /dev/null 2>&1; \\
EXIT=\"\$${AX_DOLLAR}?\"; \\
else \\
EXIT=\"1\"; \\
fi; \\
done; \\
if test -d \"\$\$RPMDIR\"; then \\
for dir in \`ls \"\$\$RPMDIR\"\`; do \\
ls \"\$\${RPMDIR}\$\${dir}/$PACKAGE-$VERSION-0.\$\${dir}.rpm\" > /dev/null 2>&1; \\
if test \"\$${AX_DOLLAR}?\" == \"0\"; then \\
cp \"\$\${RPMDIR}\$\${dir}/$PACKAGE-$VERSION-0.\$\${dir}.rpm\" \"\$(top_builddir)/$PACKAGE-$VERSION-0.\$\${dir}.$PLATFORM_SUFFIX.rpm\"; \\
found=true; \\
fi; \\
done; \\
if ! \$\$found; then \\
echo \"RPM built but not found.\"; \\
echo \"Please copy it to \$(top_builddir) manually.\"; \\
exit 1; \\
fi; \\
else \\
echo \"RPM built but I cannot find RPM directory.\"; \\
echo \"Please copy it to \$(top_builddir) manually.\"; \\
exit 1; \\
fi;
\$(top_builddir)/$PACKAGE-$VERSION.tar.gz: \$(top_builddir)/install_files
cd \"\$(top_builddir)\" && \$(MAKE) \$(AM_MAKEFLAGS) dist-gzip
$PACKAGE-$VERSION-0.src.rpm: \$(top_builddir)/rpmmacros \$(top_builddir)/$PACKAGE-$VERSION.tar.gz
@$RPM -ts \$(top_builddir)/$PACKAGE-$VERSION.tar.gz
@SRPMDIR=\`cat rpmmacros | $GAWK \'/%%_srcrpmdir/ { print ${AX_DOLLAR}${AX_DOLLAR}2; }\'\`; \\
echo \"${AX_DOLLAR}${AX_DOLLAR}SRPMDIR\" | $EGREP \"%%{.*}\" > /dev/null 2>&1; \\
EXIT=${AX_DOLLAR}${AX_DOLLAR}?; \\
while test \"${AX_DOLLAR}${AX_DOLLAR}EXIT\" == \"0\"; do \\
SRPMDIR=\`echo \"${AX_DOLLAR}${AX_DOLLAR}SRPMDIR\" | $GAWK \'/%%{.*}/ \\
{ match( ${AX_DOLLAR}${AX_DOLLAR}0, /%%{.*}/, macro ); \\
suffix = substr( ${AX_DOLLAR}${AX_DOLLAR}0, RSTART + RLENGTH ); \\
gsub( /{|}/, \"\", macro[ 0 ] ); \\
while( ( getline < \"rpmmacros\" ) > 0 ) \\
{ if( ${AX_DOLLAR}${AX_DOLLAR}1 == macro[ 0 ] ) { print ${AX_DOLLAR}${AX_DOLLAR}2 suffix; exit; } } \\
exit 1; \\
}\'\`; \\
if test \"${AX_DOLLAR}${AX_DOLLAR}?\" == \"0\"; then \\
echo \"${AX_DOLLAR}${AX_DOLLAR}SRPMDIR\" | $EGREP \"%%{.*}\" > /dev/null 2>&1; \\
EXIT=\"${AX_DOLLAR}${AX_DOLLAR}?\"; \\
else \\
EXIT=\"1\"; \\
fi; \\
done; \\
if test -d \"${AX_DOLLAR}${AX_DOLLAR}SRPMDIR\"; then \\
ls \"${AX_DOLLAR}${AX_DOLLAR}{SRPMDIR}/$PACKAGE-$VERSION-0.src.rpm\" > /dev/null 2>&1; \\
if test \"${AX_DOLLAR}${AX_DOLLAR}?\" == \"0\"; then \\
cp \"\$${AX_DOLLAR}{SRPMDIR}/$PACKAGE-$VERSION-0.src.rpm\" \"${AX_DOLLAR}(top_builddir)/.\"; \\
found=true; \\
fi; \\
if ! ${AX_DOLLAR}${AX_DOLLAR}found; then \\
echo \"SRPM built but not found.\"; \\
echo \"Please copy it to ${AX_DOLLAR}(top_builddir) manually.\"; \\
exit 1; \\
fi; \\
else \\
echo \"SRPM built but I cannot find SRPM directory.\"; \\
echo \"Please copy it to ${AX_DOLLAR}(top_builddir) directory manually.\"; \\
exit 1; \\
fi;
]])
if test "x$USING_AX_EXTRA_DIST" != "x"; then
AX_ADD_AM_MACRO([[
EXTRA_BIN_DISTS += rpm
EXTRA_SRC_DISTS += srpm
]])
fi
if test "x$USING_AX_UPLOAD" != "x"; then
AX_ADD_AM_MACRO([[
UPLOAD_BIN += upload-rpm
UPLOAD_SRC += upload-srpm
UPLOAD_TARGETS += \\
{rpm=>$PACKAGE-$VERSION-0.i*.$PLATFORM_SUFFIX.rpm} \\
{srpm=>$PACKAGE-$VERSION-0.src.rpm}
]])
fi
else
AC_MSG_RESULT([$PLATFORM_SUFFIX])
AC_MSG_WARN([rpm support disabled... PLATFORM_SUFFIX not set])
fi
else
AC_MSG_NOTICE([rpm support disabled... neither rpmbuild or rpm was found])
fi
else
AC_MSG_RESULT([not found])
AC_MSG_ERROR([rpm spec template "$1.in" could not be found])
fi
else
AC_MSG_NOTICE([rpm support disabled... install_files not available])
fi
])
</pre>
</div>
</body>
</html>
|