OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
4.1 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../libdkim/enable-linux.patch
  5. # Copyright (C) 2009 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. This patch modifies Alt-N's libdkim package to compile on Linux. This has only
  17. been tested on Gentoo linux.
  18. Installation instructions:
  19. % wget http://downloads.sourceforge.net/libdkim/libdkim-1.0.19.zip
  20. % wget http://www.bltweb.net/qmail/libdkim-1.0.19-linux.patch
  21. % unzip libdkim-1.0.19
  22. % cd libdkim/src
  23. % patch -p2 < ../../libdkim-1.0.19-linux.patch
  24. diff -Naur libdkim.orig/src/Makefile libdkim/src/Makefile
  25. --- ./Makefile 2009-03-24 08:38:48.000000000 -0500
  26. +++ ./Makefile 2009-03-24 08:39:55.000000000 -0500
  27. @@ -1,15 +1,10 @@
  28. # libdkim makefile for UNIX
  29. #
  30. -#ifdef LINUX
  31. -CFLAGS = -c
  32. -LFLAGS =
  33. +DESTDIR ?= /
  34. +
  35. +CFLAGS += -fPIC
  36. LIBS = -lcrypto -lresolv
  37. -#else
  38. -CFLAGS = -c
  39. -LFLAGS =
  40. -LIBS = -lcrypto
  41. -#endif
  42. INCL = -I /usr/include/openssl/
  43. @@ -19,23 +14,35 @@
  44. HDRS = dkim.h dns.h dkimbase.h dkimsign.h dkimverify.h
  45. -all: libdkim.a libdkimtest
  46. +all: libdkim.so.1 libdkimtest
  47. libdkim.a: $(OBJS)
  48. rm -f libdkim.a
  49. ar cr libdkim.a $(OBJS)
  50. ranlib libdkim.a
  51. -libdkimtest : libdkim.a libdkimtest.o
  52. - g++ -olibdkimtest $(LFLAGS) \
  53. - -L . libdkimtest.o $(LIBS) -ldkim
  54. +libdkim.so.1: $(OBJS)
  55. + $(CXX) -shared -Wl,-soname,$@.1 $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
  56. + ln -s $@ libdkim.so
  57. +
  58. +.cpp.o:
  59. + $(CXX) $(CFLAGS) -c $<
  60. +
  61. +libdkimtest : libdkim.so.1 libdkimtest.o
  62. + $(CXX) -o$@ $(LDFLAGS) \
  63. + -L. libdkimtest.o $(LIBS) -ldkim
  64. libdkimtest.o: libdkimtest.cpp $(HDRS)
  65. -.cpp.o:
  66. - g++ $(CFLAGS) -c $<
  67. clean:
  68. - rm *.o libdkim.lib libdkimtest
  69. + rm -f *.o libdkim.{a,so,so.1} libdkimtest
  70. +
  71. +install: all
  72. + install -D -m 0755 libdkim.so.1 $(DESTDIR)/usr/lib/libdkim.so.1
  73. + ln -s libdkim.so.1 $(DESTDIR)/usr/lib/libdkim.so
  74. + ln -s libdkim.so.1 $(DESTDIR)/usr/lib/libdkim.so.1.1
  75. + install -D -m 0644 dkim.h $(DESTDIR)/usr/include/dkim.h
  76. + install -D -m 0755 libdkimtest $(DESTDIR)/usr/bin/libdkimtest
  77. diff -Naur libdkim.orig/src/dkim.h libdkim/src/dkim.h
  78. --- ./dkim.h 2009-03-24 08:38:48.000000000 -0500
  79. +++ ./dkim.h 2009-03-24 08:39:20.000000000 -0500
  80. @@ -22,7 +22,6 @@
  81. #define DKIM_CALL WINAPI
  82. #else
  83. #define DKIM_CALL
  84. -#define MAKELONG(a,b) ((long)(((unsigned)(a) & 0xffff) | (((unsigned)(b) & 0xffff) << 16)))
  85. #endif
  86. @@ -162,6 +161,32 @@
  87. char *DKIM_CALL DKIMGetErrorString( int ErrorCode );
  88. +#ifndef _WIN32
  89. +/*
  90. + * macros.h: Useful macros
  91. + *
  92. + * Author:
  93. + * Dick Porter (dick@ximian.com)
  94. + *
  95. + * (C) 2002 Ximian, Inc.
  96. + */
  97. +#ifndef _WAPI_MACROS_H_
  98. +#define _WAPI_MACROS_H_
  99. +
  100. +#include <sys/types.h>
  101. +
  102. +#define MAKEWORD(low, high) ((__uint16_t)(((__uint8_t)(low)) | \
  103. + ((__uint16_t)((__uint8_t)(high))) << 8))
  104. +#define MAKELONG(low, high) ((__uint32_t)(((__uint16_t)(low)) | \
  105. + ((__uint32_t)((__uint16_t)(high))) << 16))
  106. +#define LOWORD(i32) ((__uint16_t)((i32) & 0xFFFF))
  107. +#define HIWORD(i32) ((__uint16_t)(((__uint32_t)(i32) >> 16) & 0xFFFF))
  108. +#define LOBYTE(i16) ((__uint8_t)((i16) & 0xFF))
  109. +#define HIBYTE(i16) ((__uint8_t)(((__uint16_t)(i16) >> 8) & 0xFF))
  110. +
  111. +#endif /* _WAPI_MACROS_H_ */
  112. +#endif
  113. +
  114. #ifdef __cplusplus
  115. }
  116. #endif
  117. diff -Naur libdkim.orig/src/dkimsign.cpp libdkim/src/dkimsign.cpp
  118. --- ./dkimsign.cpp 2009-03-24 08:38:48.000000000 -0500
  119. +++ ./dkimsign.cpp 2009-03-24 08:39:20.000000000 -0500
  120. @@ -25,8 +25,6 @@
  121. #else
  122. #define _strnicmp strncasecmp
  123. #define _stricmp strcasecmp
  124. -#define LOWORD(l) ((unsigned)(l) & 0xffff)
  125. -#define HIWORD(l) ((unsigned)(l) >> 16)
  126. #endif
  127. #include <string.h>