source: spec/trunk/SPECS/os2-rpm/macros.os2

Last change on this file was 1385, checked in by dmik, 7 years ago

spec: os2-rpm: Release version 1-2.

  • Property svn:eol-style set to native
File size: 4.6 KB
Line 
1# OS/2 specific rpm configuration file.
2
3#------------------------------------------------------------------------------
4# Macros needed at rpm runtime (package installation and such)
5
6# Path to OS/2 specific rpm configuration directory containing helper scripts
7%_rpmconfigdir_os2 @RPMCONFIGDIR_OS2@
8
9# System-wide path for OS/2 language files accessed via DPATH env. variable.
10%os2_langdir %{_datadir}/os2/lang
11
12# System-wide path for OS/2 INF files accessible via BOOKSHELF env. variable.
13%os2_bookdir %{_datadir}/os2/book
14
15# System-wide path for OS/2 HLP files accessible via HELP env. variable.
16%os2_helpdir %{_datadir}/os2/help
17
18# Converts back slashes to forward slashes.
19%os2_fwdslashes() %{lua: print((string.gsub(rpm.expand("%{?**}"), "\\\\", "/")))}
20
21# Converts forward lashes to back slashes.
22%os2_backslashes() %{lua: print((string.gsub(rpm.expand("%{?**}"), "/", "\\\\")))}
23
24# Converts a Unix path to a DOS path (backward slashes) replacing /@unixroot
25# with %UNIXROOT% if it starts the path. Note that if %UNIXROOT% per se contains
26# forward slashes, they are not converted (if you need this, use
27# os2_expand_unixroot and os2_backslashes). Several paths separated by ';' may
28# be given to handle them at once (useful for PATH-like env.vars).
29%os2_dos_path() %{lua:
30 function conv_path(path)
31 if (string.sub(path, 1, 10) == "/@unixroot" and
32 (string.len(path) == 10 or string.sub(path, 11, 11) == '/')) then
33 path = "%UNIXROOT%" .. string.sub(path, 11)
34 end
35 path = string.gsub(path, "/", "\\\\")
36 return path
37 end
38 path = rpm.expand("%{?**}")
39 seen_first = false
40 for p in string.gmatch(path, "[^;]*") do
41 print((seen_first and ';' or '') .. conv_path(p))
42 seen_first = seen_first or true
43 end
44}
45
46# Expands /@unixroot to the current value of UNIXROOT if it starts the path
47# and converts all slashes to forward ones. If you need no fowrard slashes and
48# using of %UNIXROOT% instead of the real value is fine, use os2_dos_path as
49# it doesn't reqire -e (see below). Several paths separated by ';' may be
50# given to handle them at once (useful for PATH-like env.vars).
51# NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}.
52%os2_expand_unixroot() %{lua:
53 function conv_path(path)
54 if (string.sub(path, 1, 10) == "/@unixroot" and
55 (string.len(path) == 10 or string.sub(path, 11, 11) == '/')) then
56 path = os.getenv("UNIXROOT") .. string.sub(path, 11)
57 end
58 path = string.gsub(path, "\\\\", "/")
59 return path
60 end
61 path = rpm.expand("%{?**}")
62 seen_first = false
63 for p in string.gmatch(path, "[^;]*") do
64 print((seen_first and ';' or '') .. conv_path(p))
65 seen_first = seen_first or true
66 end
67}
68
69# Expands DOS-like environment variables (%VAR%) to their current values.
70# NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}.
71%os2_expand_dos_vars() %{lua:
72 str = rpm.expand("%{?**}")
73 str = string.gsub(str, "%%(%a+)%%", os.getenv)
74 print(str)
75}
76
77# Current UNIXROOT value in DOS format (backward slashes)
78# NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}.
79%os2_unixroot_path() %{os2_backslashes %{os2_expand_unixroot /@unixroot}}
80
81# OS/2 boot drive.
82# NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}.
83%os2_boot_drive %(%{_rpmconfigdir_os2}/getbootdrive.exe)
84
85#------------------------------------------------------------------------------
86# Macros needed at package creation time
87
88# Path to script that installs legacy runtime libraries.
89%__legacy_runtime_install_post \
90 %{_rpmconfigdir_os2}/find-legacy-runtime.sh install "%{_target_cpu}" "%{_builddir}/%{?buildsubdir}"\
91%{nil}
92
93# Template for legacy runtime sub-packages.
94%legacy_runtime_packages \
95%global __legacy_runtime_packages 1\
96%{expand:%(%{_rpmconfigdir_os2}/find-legacy-runtime.sh package "%{name}" "%{_sourcedir}" "%{_target_cpu}" "%{buildroot}")}\
97%{nil}
98
99# List of debug files generated by brp-strip-os2 with %exclude prepended (to be
100# used with -f option in %files to automatically exclude them from packages).
101%debug_package_exclude_files "%{_builddir}/%{?buildsubdir}/exclude-debugfiles.list"
102
103# Only run what we really need in post-install on OS/2.
104%__os_install_post \
105 %{_rpmconfigdir}/brp-compress "./@unixroot"\
106 %{_rpmconfigdir_os2}/brp-strip-os2 "%{_builddir}/%{?buildsubdir}" %{?_strip_no_compress:--no-compress} %{!?__debug_package:--no-debuginfo} %{?_strip_opts}\
107 %{?__legacy_runtime_packages:%{__legacy_runtime_install_post}}\
108 %{?__debug_package:%{__sed} -e 's/^/%exclude /' "%{_builddir}/%{?buildsubdir}/debugfiles.list" > %{debug_package_exclude_files}}\
109%{nil}
110
111# Disable using find-debuginfo.sh, brp-strip-os2 does the job.
112%__debug_install_post %{nil}
Note: See TracBrowser for help on using the repository browser.