Thank you for sponsoring me. I am testing the fedora development tools and reading the development wiki, and hope to upload a new package in a day or two. There seems to be a lot to learn. On 8/1/06, Michael Schwendt <bugs.michael@xxxxxxx> wrote:
On Tue, 1 Aug 2006 01:59:04 +0200, Axel Liljencrantz wrote: > Thank you. So the following > > %{!?fedora: %define fedora 6} > %if "%fedora" >= "5" > BuildRequires: xorg-x11-proto-devel libX11-devel libXt-devel > %else > BuildRequires: xorg-x11-devel > %endif > > would be considered nicer than the original spec? I guess I'd agree. > The main downside is that it will not work on non-fedora systems which > do not use the same package names as fedora 5, which should be all pre > X.org-7.0 systems. Well, you could craft proper if-conditions for all supported releases of %fedora and cover old systems via %else. Alternatively, you can leave %fedora undefined whenever it is and in that case check whether it's undefined: %if 0%{?fedora} # a non-Fedora system %endif Here, %{?fedora} only expands to something if defined, and because of the prefix 0 the value becomes 0 (=false) if %fedora is undefined.
Thanks for the tip, that makes a lot of sense. I provide you with a revised, unified monster. It is hardcoded to handle all known fedora versions correctly, and in case of a non-fedora system, it falls back to checking the layout of the filesystem and performing an educated guess as to the correct dependencies. I indented it using a single tab per block level, since it was unreadable without indentation and the packaging guidelines do not mention any indentation style recomendation. If there is an informal common indentation style, please let me know. # Locate correct build-dependencies for providing X headers %if "%fedora" >= "5" #Modern Fedora version, has modular X.org BuildRequires: xorg-x11-proto-devel libX11-devel libXt-devel %else %if "%fedora" >= "3" #Semi-old Fedora version, has non-modular X.org BuildRequires: xorg-x11-devel %else %if 0%{?fedora} #This is not a Fedora system, try guessing BuildRequires by looking at the directory structure %define xinclude %( if test -d /usr/X11R6/include; then echo /usr/X11R6/include; else echo /usr/include; fi ) BuildRequires: %{xinclude}/X11/StringDefs.h, %{xinclude}/X11/Xlib.h BuildRequires: %{xinclude}/X11/Intrinsic.h, %{xinclude}/X11/Xatom.h %else #Ancient Fedora version, has XFree86 BuildRequires: XFree86-devel %endif %endif %endif Does this look ok? -- Axel -- fedora-extras-list mailing list fedora-extras-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-extras-list