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/ autom4te.cache/
contrib/pacman/PKGBUILD contrib/pacman/PKGBUILD
contrib/spec/onedrive.spec contrib/spec/onedrive.spec
contrib/systemd/onedrive.service
contrib/systemd/onedrive@.service
*.o

View file

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

View file

@ -1,4 +1,4 @@
module dnotify; module notifications.dnotify;
private { private {
import std.string : toStringz; import std.string : toStringz;
@ -7,10 +7,10 @@ private {
import std.variant : Variant; import std.variant : Variant;
import std.array : appender; 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; NotifyUrgency;

View file

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