This commit is contained in:
JC-comp 2024-01-25 19:09:27 +08:00 committed by GitHub
commit 6cfbbe8f4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 35 additions and 15 deletions

4
.gitignore vendored
View file

@ -9,3 +9,7 @@ config.status
autom4te.cache/
contrib/pacman/PKGBUILD
contrib/spec/onedrive.spec
contrib/systemd/onedrive.service
contrib/systemd/onedrive@.service
*.o

View file

@ -34,7 +34,7 @@ DEBUG = @DEBUG@
DC = @DC@
DC_TYPE = @DC_TYPE@
DCFLAGS = @DCFLAGS@
DCFLAGS += -w -g -O -J.
DCFLAGS += -w -g -O -J. -Isrc -Isrc/notifications
ifeq ($(DEBUG),yes)
ifeq ($(DC_TYPE),dmd)
DCFLAGS += -debug -gs
@ -65,6 +65,12 @@ RHEL = 0
RHEL_VERSION = 0
endif
ifneq ($(wildcard .git/HEAD),"")
VERSION = $(shell git describe --tags)
else
VERSION = $(version)
endif
SOURCES = \
src/main.d \
src/config.d \
@ -73,7 +79,7 @@ SOURCES = \
src/qxor.d \
src/curlEngine.d \
src/onedrive.d \
src/sync.d \
src/syncEngine.d \
src/itemdb.d \
src/sqlite.d \
src/clientSideFiltering.d \
@ -84,10 +90,16 @@ ifeq ($(NOTIFICATIONS),yes)
SOURCES += src/notifications/notify.d src/notifications/dnotify.d
endif
all: onedrive
# Object file
OBJ = $(SOURCES:.d=.o)
# Executable
EXE = onedrive
all: version $(EXE)
clean:
rm -f onedrive onedrive.o version
rm -f $(EXE) $(OBJ) version
rm -rf autom4te.cache
rm -f config.log config.status
@ -95,13 +107,17 @@ clean:
distclean: clean
rm -f Makefile contrib/pacman/PKGBUILD contrib/spec/onedrive.spec onedrive.1 $(system_unit_files) $(user_unit_files)
onedrive: $(SOURCES)
if [ -f .git/HEAD ] ; then \
git describe --tags > version ; \
else \
echo $(version) > version ; \
fi
$(DC) $(DCFLAGS) $(addprefix -L,$(curl_LIBS)) $(addprefix -L,$(sqlite_LIBS)) $(addprefix -L,$(notify_LIBS)) -L-ldl $(SOURCES) -of$@
version: $(SOURCES)
echo "$(VERSION)" > version;
$(EXE): $(OBJ)
$(DC) $(DCFLAGS) $(addprefix -L,$(curl_LIBS)) $(addprefix -L,$(sqlite_LIBS)) $(addprefix -L,$(notify_LIBS)) -L-ldl -of$@ $^
%.o: %.d
$(DC) $(DCFLAGS) -c $(addprefix -L,$(curl_LIBS)) $(addprefix -L,$(sqlite_LIBS)) $(addprefix -L,$(notify_LIBS)) -L-ldl -of=$@ $<
# ensure that version is ready
src/main.o: src/main.d version
install: all
$(INSTALL) -D onedrive $(DESTDIR)$(bindir)/onedrive

View file

@ -1,4 +1,4 @@
module dnotify;
module notifications.dnotify;
private {
import std.string : toStringz;
@ -7,10 +7,10 @@ private {
import std.variant : Variant;
import std.array : appender;
import deimos.notify.notify;
import notifications.notify;
}
public import deimos.notify.notify : NOTIFY_EXPIRES_DEFAULT, NOTIFY_EXPIRES_NEVER,
public import notifications.notify : NOTIFY_EXPIRES_DEFAULT, NOTIFY_EXPIRES_NEVER,
NotifyUrgency;

View file

@ -18,7 +18,7 @@
* Boston, MA 02111-1307, USA.
*/
module deimos.notify.notify;
module notifications.notify;
enum NOTIFY_VERSION_MAJOR = 0;