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