Skip to content

Commit

Permalink
Fix use of sed on BSD.
Browse files Browse the repository at this point in the history
Closes #1614. Thanks to Christoph Krey.
  • Loading branch information
ralight committed Mar 12, 2020
1 parent c84d175 commit 7f41e37
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog.txt
@@ -1,5 +1,6 @@
Build:
- Various fixes for building with <C99 support. Closes #1622.
- Fix use of sed on BSD. Closes #1614.


1.6.9 - 20200227
Expand Down
2 changes: 2 additions & 0 deletions config.mk
Expand Up @@ -158,8 +158,10 @@ PASSWD_LDADD:=

ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD), $(findstring $(UNAME),NetBSD)),)
BROKER_LDADD:=$(BROKER_LDADD) -lm
SEDINPLACE:=-i ""
else
BROKER_LDADD:=$(BROKER_LDADD) -ldl -lm
SEDINPLACE:=-i
endif

ifeq ($(UNAME),Linux)
Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile
Expand Up @@ -74,7 +74,7 @@ endif
$(INSTALL) mqtt_protocol.h "${DESTDIR}${incdir}/mqtt_protocol.h"
$(INSTALL) -d "${DESTDIR}${libdir}/pkgconfig"
$(INSTALL) -m644 ../libmosquitto.pc.in "${DESTDIR}${libdir}/pkgconfig/libmosquitto.pc"
sed -i -e "s#@CMAKE_INSTALL_PREFIX@#${prefix}#" -e "s#@VERSION@#${VERSION}#" "${DESTDIR}${libdir}/pkgconfig/libmosquitto.pc"
sed ${SEDINPLACE} -e "s#@CMAKE_INSTALL_PREFIX@#${prefix}#" -e "s#@VERSION@#${VERSION}#" "${DESTDIR}${libdir}/pkgconfig/libmosquitto.pc"
ifeq ($(WITH_SHARED_LIBRARIES),yes)
$(MAKE) -C cpp install
endif
Expand Down
2 changes: 1 addition & 1 deletion lib/cpp/Makefile
Expand Up @@ -26,7 +26,7 @@ endif
$(INSTALL) mosquittopp.h "${DESTDIR}${incdir}/mosquittopp.h"
$(INSTALL) -d "${DESTDIR}${libdir}/pkgconfig/"
$(INSTALL) -m644 ../../libmosquittopp.pc.in "${DESTDIR}${libdir}/pkgconfig/libmosquittopp.pc"
sed -i -e "s#@CMAKE_INSTALL_PREFIX@#${prefix}#" -e "s#@VERSION@#${VERSION}#" "${DESTDIR}${libdir}/pkgconfig/libmosquittopp.pc"
sed ${SEDINPLACE} -e "s#@CMAKE_INSTALL_PREFIX@#${prefix}#" -e "s#@VERSION@#${VERSION}#" "${DESTDIR}${libdir}/pkgconfig/libmosquittopp.pc"

uninstall :
-rm -f "${DESTDIR}${libdir}/libmosquittopp.so.${SOVERSION}"
Expand Down

1 comment on commit 7f41e37

@ckrey
Copy link

@ckrey ckrey commented on 7f41e37 Mar 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this solves the problem for FreeBSD, but causes the problem for OpenBSD and NetBSD

SEDINPLACE:=-i ""

is necessary for FreeBSD only:

FreeBSD man sed:

     -i extension

OpenBSD and NetBSD man sed:

  -i[extension]

Debian man sed:

       -i[SUFFIX], --in-place[=SUFFIX]

Please sign in to comment.