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

Last change on this file since 1330 was 1207, checked in by dmik, 8 years ago

spec: os2-rpm: Release version 0-4.

  • Property svn:eol-style set to native
File size: 3.7 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. Several paths separated by ';' may be
26# given to handle them at once (useful for PATH-like env.vars).
27%os2_dos_path() %{lua:
28 function conv_path(path)
29 if (string.sub(path, 1, 10) == "/@unixroot" and
30 (string.len(path) == 10 or string.sub(path, 11, 11) == '/')) then
31 path = "%UNIXROOT%" .. string.sub(path, 11)
32 end
33 path = string.gsub(path, "/", "\\\\")
34 return path
35 end
36 path = rpm.expand("%{?**}")
37 seen_first = false
38 for p in string.gmatch(path, "[^;]*") do
39 print((seen_first and ';' or '') .. conv_path(p))
40 seen_first = seen_first or true
41 end
42}
43
44# Same as os2_dos_path but converts backward slashes to forward slashes.
45%os2_dos_path_f() %{os2_fwdslashes %{os2_dos_path %{?**}}}
46
47# Expands DOS-like environment variables (%VAR%) to their current values.
48# NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}.
49%os2_expand_dos_vars() %{lua:
50 str = rpm.expand("%{?**}")
51 str = string.gsub(str, "%%(%a+)%%", os.getenv)
52 print(str)
53}
54
55# Current UNIXROOT value in DOS format (backward slashes)
56# NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}.
57%os2_unixroot_path() %{os2_expand_dos_vars %{os2_dos_path /@unixroot}}
58
59# OS/2 boot drive.
60# NOTE: Don't use in install-time scriptlets unless with -e and as %%{...}.
61%os2_boot_drive %(%{_rpmconfigdir_os2}/getbootdrive.exe)
62
63#------------------------------------------------------------------------------
64# Macros needed at package creation time
65
66# Path to script that installs legacy runtime libraries.
67%__legacy_runtime_install_post \
68 %{_rpmconfigdir_os2}/find-legacy-runtime.sh install "%{_target_cpu}" "%{_builddir}/%{?buildsubdir}"\
69%{nil}
70
71# Template for legacy runtime sub-packages.
72%legacy_runtime_packages \
73%global __legacy_runtime_packages 1\
74%{expand:%(%{_rpmconfigdir_os2}/find-legacy-runtime.sh package "%{name}" "%{_sourcedir}" "%{_target_cpu}" "%{buildroot}")}\
75%{nil}
76
77# List of debug files generated by brp-strip-os2 with %exclude prepended (to be
78# used with -f option in %files to automatically exclude them from packages).
79%debug_package_exclude_files "%{_builddir}/%{?buildsubdir}/exclude-debugfiles.list"
80
81# Only run what we really need in post-install on OS/2.
82%__os_install_post \
83 %{_rpmconfigdir}/brp-compress "./@unixroot"\
84 %{_rpmconfigdir_os2}/brp-strip-os2 "%{_builddir}/%{?buildsubdir}" %{?_strip_no_compress:--no-compress} %{!?__debug_package:--no-debuginfo} %{?_strip_opts}\
85 %{?__legacy_runtime_packages:%{__legacy_runtime_install_post}}\
86 %{?__debug_package:%{__sed} -e 's/^/%exclude /' "%{_builddir}/%{?buildsubdir}/debugfiles.list" > %{debug_package_exclude_files}}\
87%{nil}
88
89# Disable using find-debuginfo.sh, brp-strip-os2 does the job.
90%__debug_install_post %{nil}
Note: See TracBrowser for help on using the repository browser.