Added flexdll.
[fedora-mingw.git] / flexdll / mingw32-flexdll.spec
1 %define __strip %{_mingw32_strip}
2 %define __objdump %{_mingw32_objdump}
3 %define _use_internal_dependency_generator 0
4 %define __find_requires %{_mingw32_findrequires}
5 %define __find_provides %{_mingw32_findprovides}
6
7 %define debug_package %{nil}
8
9 Name:           mingw32-flexdll
10 Version:        0.11
11 Release:        1%{?dist}
12 Summary:        FlexDLL Windows DLL plugin API which is like dlopen
13
14 License:        zlib
15 Group:          Development/Libraries
16
17 URL:            http://alain.frisch.fr/flexdll.html
18 Source0:        http://alain.frisch.fr/flexdll/flexdll-%{version}.tar.gz
19 Source1:        flexlink.exe
20
21 # Patches for MinGW:
22 Patch1000:      mingw32-flexdll-0.11-mingw-cross.patch
23
24 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
25
26 BuildRequires:  mingw32-filesystem >= 35
27 BuildRequires:  mingw32-gcc
28 BuildRequires:  mingw32-binutils
29 BuildRequires:  ocaml
30
31
32 %description
33 Under Windows, DLL (Dynamically-Linked Libraries) are generally used
34 to improve code modularity and sharing. A DLL can be loaded
35 automatically when the program is loaded (if it requires the DLL). The
36 program can also explicitly request Windows to load a DLL at any
37 moment during runtime, using the LoadLibrary function from the Win32
38 API.
39
40 This naturally suggests to use DLLs as a plugin mechanism. For
41 instance, a web server could load extensions modules stored in DLLs at
42 runtime. But Windows does not really make it easy to implement plugins
43 that way. The reason is that when you try to create a DLL from a set
44 of object files, the linker needs to resolve all the symbols, which
45 leads to the very problem solved by FlexDLL:
46
47 Windows DLL cannot refer to symbols defined in the main application or
48 in previously loaded DLLs.
49
50 Some usual solutions exist, but they are not very flexible. A notable
51 exception is the edll library (its homepage also describes the usual
52 solutions), which follows a rather drastic approach; indeed, edll
53 implements a new dynamic linker which can directly load object files
54 (without creating a Windows DLL).
55
56 FlexDLL is another solution to the same problem. Contrary to edll, it
57 relies on the native static and dynamic linkers. Also, it works both
58 with the Microsoft environment (MS linker, Visual Studio compilers)
59 and with Cygwin (GNU linker and compilers, in Cygwin or MinGW
60 mode). Actually, FlexDLL implements mostly the usual dlopen POSIX API,
61 without trying to be fully conformant though (e.g. it does not respect
62 the official priority ordering for symbol resolution). This should
63 make it easy to port applications developed for Unix.
64
65
66 %prep
67 %setup -q -n flexdll
68
69 %patch1000 -p1
70
71 for f in CHANGES LICENSE README; do
72   chmod -x $f
73   dos2unix $f
74 done
75
76
77 %build
78 make TOOLCHAIN=mingw MINCC=%{_mingw32_cc} CC=%{_mingw32_cc} \
79   flexlink.exe build_mingw
80
81 strip flexlink.exe
82
83
84 %check
85 make -C test CC=%{_mingw32_cc} O=o CHAIN=mingw
86
87
88 %install
89 rm -rf $RPM_BUILD_ROOT
90
91 mkdir -p $RPM_BUILD_ROOT%{_bindir}
92 mkdir -p $RPM_BUILD_ROOT%{_libdir}/flexdll
93
94 # Install everything in a libdir directory.  Some of the files
95 # have execute permissions which we can remove.
96 install -m 0644 \
97   flexdll.h flexdll.c flexdll_initer.c default.manifest flexdll_*.o \
98   $RPM_BUILD_ROOT%{_libdir}/flexdll
99 install -m 0755 flexlink.exe \
100   $RPM_BUILD_ROOT%{_libdir}/flexdll
101
102 # Provide a wrapper script which sets FLEXDIR to point to the
103 # libdir directory.
104 sed 's,@libdir@,%{_libdir},g' \
105   < %{SOURCE1} > $RPM_BUILD_ROOT%{_bindir}/flexlink.exe
106 chmod 0755 $RPM_BUILD_ROOT%{_bindir}/flexlink.exe
107
108
109 %clean
110 rm -rf $RPM_BUILD_ROOT
111
112
113 %files
114 %defattr(-,root,root)
115 %doc LICENSE README CHANGES
116 %{_bindir}/flexlink.exe
117 %{_libdir}/flexdll
118
119
120 %changelog
121 * Fri Nov 14 2008 Richard W.M. Jones <rjones@redhat.com> - 0.11-1
122 - Initial RPM release.