Skip to content

Commit 56bec4c

Browse files
committed
Separately builds rpm or deb based on availability.
1 parent 3288048 commit 56bec4c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

GNUmakefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ DYLIB_EXT = so
1515
DYNAMIC_LIB := -shared -fPIC
1616
CFLAGS := $(CFLAGS) -lpthread -ldl
1717
CXXFLAGS := $(CXXFLAGS) -lcurl -lssl -lcrypto
18-
PACKAGE := linux-package
18+
19+
ifneq ($(shell command -v rpm 2>/dev/null),)
20+
PACKAGE := rpm-package
21+
endif
22+
# Check for deb (apt/dpkg)
23+
ifneq ($(shell command -v dpkg 2>/dev/null),)
24+
PACKAGE := deb-package
25+
endif
26+
1927
endif
2028

2129
LIBFILE := $(LIBNAME).$(DYLIB_EXT)
@@ -51,10 +59,6 @@ pkg: sqlwrite-bin $(LIBFILE) $(SQLITE_LIB)
5159
pkgbuild --root pkg_root --identifier $(DOMAIN) --version 1.0 --install-location / sqlwrite-mac.pkg
5260
endif
5361

54-
# Packaging for Linux systems
55-
56-
linux-package: deb-package rpm-package
57-
5862
deb-package: sqlwrite-bin $(LIBFILE) $(SQLITE_LIB)
5963
# Create the package directory structure
6064
mkdir -p pkg_root/usr/local/bin
@@ -107,6 +111,6 @@ rpm-package: sqlwrite-bin $(LIBFILE) $(SQLITE_LIB)
107111
cp rpmbuild/RPMS/*/sqlwrite-1.0-1.*.rpm sqlwrite-linux.rpm
108112

109113
clean:
110-
rm -rf sqlwrite-mac.pkg sqlwrite-linux.deb sqlwrite-bin $(LIBFILE) $(SQLITE_LIB)
114+
rm -rf sqlwrite-mac.pkg sqlwrite-linux.deb sqlwrite-linux.rpm sqlwrite-bin $(LIBFILE) $(SQLITE_LIB)
111115

112116

0 commit comments

Comments
 (0)