No edit summary |
|||
Line 56: | Line 56: | ||
%{_d_libdir} define ''/usr/lib64/d'' or ''/usr/lib/d'' directory | %{_d_libdir} define ''/usr/lib64/d'' or ''/usr/lib/d'' directory | ||
== SPEC | == SPEC == | ||
=== Tips === | |||
If you package do not contain a shared library but only static library you shoul write at top of spec file: | |||
%global debug_package %{nil} | |||
Because GNU strip can't extract debug symbols from static lib achieves. | |||
=== Template === | |||
here an template for D package with static libraries | here an template for D package with static libraries | ||
<pre> | <pre> | ||
%global debug_package %{nil} | |||
Name: | Name: | ||
Version: | Version: |
Revision as of 10:03, 5 August 2010
Revision: 0.1
Last Revised: Wednesday Jul 28, 2010
Packaging Tips
File Locations
Libraries
D packages must install assemblies to %{_d_libdir} rather than /usr/lib or %{_datadir}.
Header
D package must install header file like .d or .di to %{_d_includedir}/%{name}
Libraries
At this time in D programming only OS X support shared lirbraries. So wait this feature or help ldc project. Feel free.
For build static librarie in D you need use ar and ranlib tools. ldc compiler support GNU strip.
short example from makefile:
DC=ldc HD=-Hd $(IMPORT_DEST) DFLAGS_REQ=-c -I ../DerelictUtil AL_SRC= \ derelict/openal/al.d \ derelict/openal/alfuncs.d \ derelict/openal/altypes.d PACKAGE_PATH=derelict/openal all : DerelictAL $(LIB_PRE)DerelictAL.$(LIB_EXT) : $(DC) $(DFLAGS) $(DFLAGS_REQ) $(AL_SRC) $(HD)/$(PACKAGE_PATH) $(AR) rcs $@ $^ $(RANLIB) $@ $(CP) $@ $(LIB_DEST) $(RM) $@
Macros
All D package need ldc for build and macro file is in ldc package, every package must have ldc in BuildRequire
Compiler options
%{_d_optflags} need be used for ldc options
%{_d_optflags} define options -release -w -g -O2
-release disables asserts, invariants, contracts and boundscheck
-w enable warnings
-g generate debug information
-O2 for make a good optimisation
Include directories
%{_d_includedir} need be used for devel file
%{_d_includedir} define /usr/include/d/ directory
Lib directories
%{_d_libdir} lib directory path used for static library (and later i hope shared library) %{_d_libdir} define /usr/lib64/d or /usr/lib/d directory
SPEC
Tips
If you package do not contain a shared library but only static library you shoul write at top of spec file:
%global debug_package %{nil}
Because GNU strip can't extract debug symbols from static lib achieves.
Template
here an template for D package with static libraries
%global debug_package %{nil} Name: Version: Release: 1%{?dist} Summary: Development/Libraries Group: License: URL: Source0: BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: ldc Requires: tango %description %package devel Provides: %{name}-static = %{version}-%{release} Summary: Support for developing D application Group: Development/Libraries %prep %setup -q %build %configure make %{?_smp_mflags} %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} %clean rm -rf %{buildroot} %files devel %defattr(-,root,root,-) %doc README.txt LICENSE.txt %{_d_includedir}/%{name} %{_libdir}/%{name}/<static-libraries.a> %changelog