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.

130 lines
3.7 KiB

fix ENGINE-956 It is now possible to use shell environment variables in PER_USER_DIRECTORY and PER_MACHINE_DIRECTORY, expanded at *run* time. This is meant to allow more freedom to the deployment engineer, without affecting development. Notice that, when PER_USER_DIRECTORY and PER_MACHINE_DIRECTORY are defined in the Makefile, dollar signs must be escaped (a dollar becomes a double dollar) because of *make* syntax: this has nothing to do with pEp engine code. Expansion follows the Unix shell $VARIABLE syntax: ${VARIABLE} is not supported. See _expand_variables. src/platform_unix.c contained some duplicated logic about caching path results into static variables; this change set would have added to the complexity by calling the new path expansion function, in many different places. Seize the occasion for factoring. Do not change the meaning of PER_USER_DIRECTORY yet; I would like to do it, since it is confusing and inconsistent with per_user_directory (PER_USER_DIRECTORY is a relative path on Unix, while per_user_directory is absolute), but the actual semantics with respect to $HOME and $PEP_HOME is complicated and I do not want to break it. New API function per_user_relative_directory. Remove the ugly "reset" argument from unix_local_db (which was conditionally defined according to NDEBUG!), used to force path re-computation in the test suite after changing an environment variable so as to work in a new "home" directory. In the place of this reset argument add clear API functions to the engine for handling the cache. My quick grapping and IRC interaction confirm that nobody was using the functionality out of the engine test suite. Adapt the test suite to use the new API. Tentatively add caching and expansion functionality to android_system_db as well.
3 months ago
2 years ago
fix ENGINE-956 It is now possible to use shell environment variables in PER_USER_DIRECTORY and PER_MACHINE_DIRECTORY, expanded at *run* time. This is meant to allow more freedom to the deployment engineer, without affecting development. Notice that, when PER_USER_DIRECTORY and PER_MACHINE_DIRECTORY are defined in the Makefile, dollar signs must be escaped (a dollar becomes a double dollar) because of *make* syntax: this has nothing to do with pEp engine code. Expansion follows the Unix shell $VARIABLE syntax: ${VARIABLE} is not supported. See _expand_variables. src/platform_unix.c contained some duplicated logic about caching path results into static variables; this change set would have added to the complexity by calling the new path expansion function, in many different places. Seize the occasion for factoring. Do not change the meaning of PER_USER_DIRECTORY yet; I would like to do it, since it is confusing and inconsistent with per_user_directory (PER_USER_DIRECTORY is a relative path on Unix, while per_user_directory is absolute), but the actual semantics with respect to $HOME and $PEP_HOME is complicated and I do not want to break it. New API function per_user_relative_directory. Remove the ugly "reset" argument from unix_local_db (which was conditionally defined according to NDEBUG!), used to force path re-computation in the test suite after changing an environment variable so as to work in a new "home" directory. In the place of this reset argument add clear API functions to the engine for handling the cache. My quick grapping and IRC interaction confirm that nobody was using the functionality out of the engine test suite. Adapt the test suite to use the new API. Tentatively add caching and expansion functionality to android_system_db as well.
3 months ago
2 years ago
fix ENGINE-956 It is now possible to use shell environment variables in PER_USER_DIRECTORY and PER_MACHINE_DIRECTORY, expanded at *run* time. This is meant to allow more freedom to the deployment engineer, without affecting development. Notice that, when PER_USER_DIRECTORY and PER_MACHINE_DIRECTORY are defined in the Makefile, dollar signs must be escaped (a dollar becomes a double dollar) because of *make* syntax: this has nothing to do with pEp engine code. Expansion follows the Unix shell $VARIABLE syntax: ${VARIABLE} is not supported. See _expand_variables. src/platform_unix.c contained some duplicated logic about caching path results into static variables; this change set would have added to the complexity by calling the new path expansion function, in many different places. Seize the occasion for factoring. Do not change the meaning of PER_USER_DIRECTORY yet; I would like to do it, since it is confusing and inconsistent with per_user_directory (PER_USER_DIRECTORY is a relative path on Unix, while per_user_directory is absolute), but the actual semantics with respect to $HOME and $PEP_HOME is complicated and I do not want to break it. New API function per_user_relative_directory. Remove the ugly "reset" argument from unix_local_db (which was conditionally defined according to NDEBUG!), used to force path re-computation in the test suite after changing an environment variable so as to work in a new "home" directory. In the place of this reset argument add clear API functions to the engine for handling the cache. My quick grapping and IRC interaction confirm that nobody was using the functionality out of the engine test suite. Adapt the test suite to use the new API. Tentatively add caching and expansion functionality to android_system_db as well.
3 months ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. # Copyright 2017, pEp Foundation
  2. # This file is part of pEpEngine
  3. # This file may be used under the terms of the GNU General Public License version 3
  4. # see LICENSE.txt
  5. include ../Makefile.conf
  6. # Notice the single quotes below: since user definitions can contain dollar
  7. # signs it is important to prevent their expansion: shell variable references
  8. # here must be expanded at run time, and not at compile time.
  9. ifdef PER_USER_DIRECTORY
  10. EXTRA_MACROS+= -DPER_USER_DIRECTORY='"$(PER_USER_DIRECTORY)"'
  11. endif
  12. ifdef PER_MACHINE_DIRECTORY
  13. EXTRA_MACROS+= -DPER_MACHINE_DIRECTORY='"$(PER_MACHINE_DIRECTORY)"'
  14. endif
  15. NO_SOURCE=
  16. ifndef PEP_MIME
  17. CFLAGS+= $(ETPAN_INC)
  18. LDFLAGS+= $(ETPAN_LIB)
  19. LDLIBS+= -letpan
  20. else
  21. LDFLAGS+= -L../pEpMIME -shared
  22. LDLIBS+= -lpEpMIME
  23. NO_SOURCE+= etpan_mime.c
  24. endif
  25. CFLAGS+= -I../asn.1 $(EXTRA_MACROS)
  26. CPPFLAGS+= -DSQLITE_THREADSAFE=1
  27. LDFLAGS+= -L../asn.1 -shared
  28. LDLIBS+= -lc -lasn1
  29. ifeq ($(BUILD_ON),Darwin)
  30. ifeq ($(BUILD_FOR),Darwin)
  31. LDLIBS+= -lz -liconv -mmacosx-version-min=10.10
  32. else
  33. $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
  34. endif
  35. else ifeq ($(BUILD_ON),Linux)
  36. ifeq ($(BUILD_FOR),Linux)
  37. CPPFLAGS+= -D_GNU_SOURCE
  38. LDLIBS+= -ldl -luuid
  39. else
  40. $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
  41. endif
  42. else
  43. $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
  44. endif
  45. ifdef SQLITE3_FROM_OS
  46. NO_SOURCE+= sqlite3.c
  47. CPPFLAGS+= -DSQLITE3_FROM_OS
  48. LDLIBS+= -lsqlite3
  49. endif
  50. ifeq ($(OPENPGP),SEQUOIA)
  51. CPPFLAGS+= -DUSE_SEQUOIA
  52. CFLAGS+= $(SEQUOIA_CFLAGS) $(SEQUOIA_INC)
  53. LDFLAGS+= $(SEQUOIA_LDFLAGS)
  54. LDLIBS+= $(SEQUOIA_LIB)
  55. else
  56. $(error Unknown OpenPGP library: $(OPENPGP))
  57. endif
  58. ALL_SOURCE=$(filter-out $(NO_SOURCE),$(wildcard *.c))
  59. DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
  60. ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
  61. all: $(TARGET)
  62. -include Makefile.protocols
  63. %.d: %.c
  64. @set -e; rm -f $@; \
  65. $(CC) -MM $(CFLAGS) $(CPPFLAGS) $< > $@.$$$$; \
  66. sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
  67. rm -f $@.$$$$
  68. # If only the goal 'clean' is given, do not generate and include the '%.d' files.
  69. ifneq ($(MAKECMDGOALS),clean)
  70. -include $(DEPENDS)
  71. endif
  72. $(TARGET): libpEpEngine.a
  73. $(CC) $(CFLAGS) $(CPPFLAGS) $(ALL_OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@
  74. .PHONY: objects clean install_headers install uninstall beinstall
  75. objects: $(ALL_OBJECTS)
  76. libpEpEngine.a: $(ALL_OBJECTS)
  77. $(AR) -rc $@ $^
  78. clean:
  79. rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
  80. rm -Rf $(TARGET).dSYM
  81. rm -f KeySync_fsm.* Sync_actions.c Sync_event.* Sync_func.* Sync_impl.* sync_codec.* distribution_codec.* storage_codec.*
  82. # CAVEAT:
  83. # install_headers is needed for building *STANDALONE* pEp MIME - it is NOT used for built-in functionality!!!
  84. install_headers: $(TARGET)
  85. mkdir -p $(DESTDIR)$(PREFIX)/include/pEp
  86. cp pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h \
  87. timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h group.h \
  88. cryptotech.h sync_api.h pEp_string.h openpgp_compat.h engine_sql.h \
  89. labeled_int_list.h key_reset.h base64.h sync_codec.h distribution_codec.h storage_codec.h \
  90. status_to_string.h keyreset_command.h platform.h platform_unix.h ../asn.1/*.h \
  91. $(DESTDIR)$(PREFIX)/include/pEp/
  92. # FIXME: Does anyone but Roker use install_headers? Otherwise, remove the dependency.
  93. install: $(TARGET) install_headers
  94. mkdir -p "$(DESTDIR)$(PREFIX)/lib/"
  95. cp -v $< $(DESTDIR)$(PREFIX)/lib/
  96. cp -v libpEpEngine.a $(DESTDIR)$(PREFIX)/lib/
  97. beinstall: install
  98. cp platform*.h $(DESTDIR)$(PREFIX)/include/pEp/
  99. uninstall:
  100. rm -f $(DESTDIR)$(PREFIX)/lib/$(TARGET)
  101. rm -rf $(DESTDIR)$(PREFIX)/include/pEp
  102. tags: $(wildcard *.c) $(wildcard *.h)
  103. ctags --sort=yes *.c *.h