patch-imap_src_osdep_unix_Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. $OpenBSD: patch-imap_src_osdep_unix_Makefile,v 1.5 2017/04/25 09:20:53 ajacoutot Exp $
  2. --- imap/src/osdep/unix/Makefile.orig Mon Jan 12 06:12:25 2015
  3. +++ imap/src/osdep/unix/Makefile Thu Mar 10 22:35:28 2016
  4. @@ -44,7 +44,7 @@ IP=4
  5. # -O3 seems to be safe, but empirical observation from our local expert
  6. # indicates that in some (many?) cases -O3 code runs slower than -O2.
  7. -GCCOPTLEVEL= -O2
  8. +GCCOPTLEVEL=
  9. # Try to have some consistency in GCC builds. We want optimization, but we
  10. @@ -56,9 +56,9 @@ GCC4CFLAGS= $(GCCCFLAGS) -Wno-pointer-sign
  11. # Extended flags needed for SSL. You may need to modify.
  12. -SSLDIR=/usr/local/ssl
  13. -SSLCERTS=$(SSLDIR)/certs
  14. -SSLKEYS=$(SSLCERTS)
  15. +SSLDIR=/usr
  16. +SSLCERTS=/etc/ssl
  17. +SSLKEYS=$(SSLCERTS)/private
  18. SSLINCLUDE=$(SSLDIR)/include
  19. SSLLIB=$(SSLDIR)/lib
  20. @@ -150,6 +150,8 @@ DEFAULTAUTHENTICATORS=ext md5 pla log
  21. DEFAULTDRIVERS=imap nntp pop3 mix mx mbx tenex mtx mh mmdf unix news phile
  22. CHUNKSIZE=65536
  23. +.SUFFIXES: .o .so
  24. +
  25. # Normally no need to change any of these
  26. ARCHIVE=c-client.a
  27. @@ -157,6 +159,7 @@ BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf
  28. dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
  29. rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
  30. unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
  31. +SOBINARIES=$(BINARIES:.o=.so)
  32. CFLAGS=-g
  33. CAT=cat
  34. @@ -165,6 +168,11 @@ MV=mv
  35. RM=rm -rf
  36. SH=sh
  37. +.if ${MACHINE_ARCH} == "sparc64"
  38. +PICFLAG= -fPIC
  39. +.else
  40. +PICFLAG= -fpic
  41. +.endif
  42. # Primary build command
  43. @@ -284,6 +292,7 @@ bso: # OpenBSD
  44. SPOOLDIR=/var \
  45. ACTIVEFILE=/usr/local/news/lib/active \
  46. RSHPATH=/usr/bin/rsh \
  47. + LOCKPGM=$(PREFIX)/libexec/mlock \
  48. BASECFLAGS="$(GCCCFLAGS)"
  49. cvx: # Convex
  50. @@ -864,23 +873,29 @@ vu2: # VAX Ultrix 2.3, etc.
  51. # Build it!
  52. -build: clean once $(ARCHIVE)
  53. +build: clean once $(ARCHIVE) $(SHLIB)
  54. -all: $(ARCHIVE)
  55. +all: $(ARCHIVE) $(SHLIB)
  56. $(ARCHIVE): $(BINARIES)
  57. sh -c '$(RM) $(ARCHIVE) || true'
  58. @$(CAT) ./ARCHIVE
  59. @$(SH) ./ARCHIVE
  60. +$(SHLIB): $(SOBINARIES)
  61. + $(CC) -shared $(PICFLAG) -o $(SHLIB) $(SOBINARIES)
  62. +
  63. .c.o:
  64. `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` $*.c
  65. +.c.so:
  66. + `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` $(PICFLAG) -DPIC $(@:.so=.c) -o $@
  67. +
  68. # Cleanup
  69. clean:
  70. - sh -c '$(RM) auths.c crexcl.c ip_unix.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE *FLAGS *TYPE $(ARCHIVE) || true'
  71. + sh -c '$(RM) auths.c crexcl.c linkage.[ch] siglocal.c osdep*.[ch] *.o *.so ARCHIVE *FLAGS *TYPE $(ARCHIVE) $(SHLIB) || true'
  72. # Dependencies
  73. @@ -915,7 +930,7 @@ utf8aux.o: mail.h misc.h osdep.h utf8.h
  74. # OS-dependent
  75. -osdep.o:mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \
  76. +OSDEPS= mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \
  77. osdep.h env_unix.h tcp_unix.h \
  78. osdep.c env_unix.c fs_unix.c ftl_unix.c nl_unix.c tcp_unix.c ip_unix.c\
  79. auths.c crexcl.c flockcyg.c flocklnx.c flocksim.c fsync.c \
  80. @@ -929,12 +944,12 @@ osdep.o:mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \
  81. write.c sslstdio.c \
  82. strerror.c strpbrk.c strstr.c strtok.c strtoul.c \
  83. OSCFLAGS
  84. - @echo Building OS-dependent module
  85. - @echo If you get No such file error messages for files x509.h, ssl.h,
  86. - @echo pem.h, buffer.h, bio.h, and crypto.h, that means that OpenSSL
  87. - @echo is not installed on your system. Either install OpenSSL first
  88. - @echo or build with command: make `$(CAT) OSTYPE` SSLTYPE=none
  89. - `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` -c osdep.c
  90. +
  91. +osdep.o: $(OSDEPS)
  92. + `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` osdep.c
  93. +
  94. +osdep.so: $(OSDEPS)
  95. + `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` $(PICFLAG) -DPIC osdep.c -o $@
  96. osdep.c: osdepbas.c osdepckp.c osdeplog.c osdepssl.c
  97. $(CAT) osdepbas.c osdepckp.c osdeplog.c osdepssl.c > osdep.c