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