Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

D.txt 3.1 KB

You have to be logged in to leave a comment. Sign In
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
  1. = D Packaging Guidelines
  2. == ldc
  3. All D packages depend on ldc to build, so every package must have ldc as BuildRequires. In addition, the ldc package includes some useful macros for D packages.
  4. === Compiler options
  5. `+%{_d_optflags}+` must be used with ldc (normal `+%{optflags}+` do not apply to ldc, only to gcc).
  6. `+%{_d_optflags}+` is defined as:
  7. ....
  8. -release -w -g -O2
  9. ....
  10. -release _disables asserts, invariants, contracts and boundscheck_ +
  11. -w _enables warnings_ +
  12. -g _generates debug information_ +
  13. -O2 _is the optimisation level_
  14. Some D packages use Makefiles, which usually use the $DFLAGS variable in the same way that C packages with Makefiles use $CFLAGS. In this case, `+export DFLAGS="%{_d_optflags}"+` is usually appropriate. In other cases, the build script in the D package has an option to pass in `+%{_d_optflags}+`. It is the responsibility of the packager to ensure that `+%{_d_optflags}+` are used with ldc when the package is built.
  15. === Header Files
  16. D packages contain header files, which end with .d or .di. These header files must be installed into `+%{_d_includedir}/%{name}+`.
  17. `+%{_d_includedir}+` is defined as:
  18. ....
  19. /usr/include/d/
  20. ....
  21. == Libraries
  22. At this time, Linux does not support shared libraries for D code (only OSX does).
  23. As a result, D packages are explicitly excluded from the restrictions against packaging static libraries.
  24. To build static libraries in D, you use the same tools that you would for C, specifically, ar, ranlib, and strip.
  25. If your D package contains static libraries, you must disable debuginfo generation, by adding this line to the top of your spec file:
  26. ....
  27. %global debug_package %{nil}
  28. ....
  29. Otherwise, it would generate an empty debuginfo package.
  30. All static libraries must be placed in the *-devel subpackage. When doing this, you must also have
  31. `+Provides: %{name}-static = %{version}-%{release}+` in the devel package definition.
  32. It is possible that this will leave the root package empty, if this is the case, do not list a %files section for the root package, only for the -devel package. This is illustrated in the example template below.
  33. == Template
  34. ....
  35. %global debug_package %{nil}
  36. Name: foo
  37. Version: 1.2.3
  38. Release: 1%{?dist}
  39. Summary: Does foo in D
  40. Group: Development/Libraries
  41. License: LGPLv2+
  42. URL: https://anywhere.com/
  43. Source: https://anywhere.com/%{name}-%{version}.tar.bz2
  44. BuildRequires: ldc
  45. Requires: tango
  46. %description
  47. Foo and bar.
  48. %package devel
  49. Provides: %{name}-static = %{version}-%{release}
  50. Summary: Support for developing D application
  51. Group: Development/Libraries
  52. %prep
  53. %setup -q
  54. %build
  55. export DFLAGS="%{_d_optflags}"
  56. %configure
  57. make %{?_smp_mflags}
  58. %install
  59. mkdir -p %{buildroot}%{_libdir}
  60. mkdir -p %{buildroot}%{_d_includedir}/%{name}/
  61. make install DESTDIR=%{buildroot}
  62. install -m 0644 lib/* %{buildroot}%{_libdir}
  63. install -m 0644 include/* %{buildroot}%{_d_includedir}/%{name}/
  64. %clean
  65. rm -rf %{buildroot}
  66. %files devel
  67. %doc README.txt
  68. %license LICENSE.txt
  69. %{_d_includedir}/%{name}/
  70. %{_libdir}/*.a
  71. %changelog
  72. * Wed Aug 25 2010 John Doe <jdoe@anywhere.com> 1.2.3-1
  73. - initial package
  74. ....
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...