smock: use $basearch in smock.mock.extra
[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:        9%{?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 Patch1001:      mingw32-flexdll-0.11-no-cygpath.patch
27 Patch1002:      mingw32-flexdll-0.11-no-directory.patch
28 Patch1003:      mingw32-flexdll-0.11-real-objdump.patch
29
30 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
31
32 BuildRequires:  mingw32-filesystem >= 35
33 BuildRequires:  mingw32-gcc
34 BuildRequires:  mingw32-binutils
35 BuildRequires:  ocaml
36 BuildRequires:  dos2unix
37
38
39 %description
40 Under Windows, DLL (Dynamically-Linked Libraries) are generally used
41 to improve code modularity and sharing. A DLL can be loaded
42 automatically when the program is loaded (if it requires the DLL). The
43 program can also explicitly request Windows to load a DLL at any
44 moment during runtime, using the LoadLibrary function from the Win32
45 API.
46
47 This naturally suggests to use DLLs as a plugin mechanism. For
48 instance, a web server could load extensions modules stored in DLLs at
49 runtime. But Windows does not really make it easy to implement plugins
50 that way. The reason is that when you try to create a DLL from a set
51 of object files, the linker needs to resolve all the symbols, which
52 leads to the very problem solved by FlexDLL:
53
54 Windows DLL cannot refer to symbols defined in the main application or
55 in previously loaded DLLs.
56
57 Some usual solutions exist, but they are not very flexible. A notable
58 exception is the edll library (its homepage also describes the usual
59 solutions), which follows a rather drastic approach; indeed, edll
60 implements a new dynamic linker which can directly load object files
61 (without creating a Windows DLL).
62
63 FlexDLL is another solution to the same problem. Contrary to edll, it
64 relies on the native static and dynamic linkers. Also, it works both
65 with the Microsoft environment (MS linker, Visual Studio compilers)
66 and with Cygwin (GNU linker and compilers, in Cygwin or MinGW
67 mode). Actually, FlexDLL implements mostly the usual dlopen POSIX API,
68 without trying to be fully conformant though (e.g. it does not respect
69 the official priority ordering for symbol resolution). This should
70 make it easy to port applications developed for Unix.
71
72
73 %prep
74 %setup -q -n flexdll
75
76 %patch1000 -p1
77 %patch1001 -p1
78 %patch1002 -p1
79 %patch1003 -p1
80
81 for f in CHANGES LICENSE README; do
82   chmod -x $f
83   dos2unix $f
84 done
85
86
87 %build
88 make TOOLCHAIN=mingw MINCC=%{_mingw32_cc} CC=%{_mingw32_cc} \
89   flexlink.exe build_mingw
90
91 strip flexlink.exe
92
93
94 %check
95 %if %{run_tests}
96 make -C test CC=%{_mingw32_cc} O=o CHAIN=mingw
97 %endif
98
99
100 %install
101 rm -rf $RPM_BUILD_ROOT
102
103 mkdir -p $RPM_BUILD_ROOT%{_bindir}
104 mkdir -p $RPM_BUILD_ROOT%{_libdir}/flexdll
105
106 # Install everything in a libdir directory.  Some of the files
107 # have execute permissions which we can remove.
108 install -m 0644 \
109   flexdll.h flexdll.c flexdll_initer.c default.manifest flexdll_*.o \
110   $RPM_BUILD_ROOT%{_libdir}/flexdll
111 install -m 0755 flexlink.exe \
112   $RPM_BUILD_ROOT%{_libdir}/flexdll
113
114 # Provide a wrapper script which sets FLEXDIR to point to the
115 # libdir directory.  Some programs call 'flexlink' and some call
116 # 'flexlink.exe' so provide both.
117 sed 's,@libdir@,%{_libdir},g' \
118   < %{SOURCE1} > $RPM_BUILD_ROOT%{_bindir}/flexlink.exe
119 chmod 0755 $RPM_BUILD_ROOT%{_bindir}/flexlink.exe
120 (cd $RPM_BUILD_ROOT%{_bindir} && ln flexlink.exe flexlink)
121
122
123 %clean
124 rm -rf $RPM_BUILD_ROOT
125
126
127 %files
128 %defattr(-,root,root)
129 %doc LICENSE README CHANGES
130 %{_bindir}/flexlink
131 %{_bindir}/flexlink.exe
132 %{_libdir}/flexdll
133
134
135 %changelog
136 * Fri Feb 20 2009 Richard W.M. Jones <rjones@redhat.com> - 0.11-9
137 - Rebuild for mingw32-gcc 4.4
138
139 * Mon Nov 17 2008 Richard W.M. Jones <rjones@redhat.com> - 0.11-8
140 - Apply real-objdump patch.
141
142 * Sun Nov 16 2008 Richard W.M. Jones <rjones@redhat.com> - 0.11-7
143 - Apply no-directory patch.
144
145 * Sun Nov 16 2008 Richard W.M. Jones <rjones@redhat.com> - 0.11-6
146 - Permanently disable cygpath (avoids 'NUL' file being created).
147
148 * Fri Nov 14 2008 Richard W.M. Jones <rjones@redhat.com> - 0.11-4
149 - Initial RPM release.