b17e36f
%global _smp_mflags -j1
79f4da1
79f4da1
%global sname deepin-daemon
00831f1
%global repo dde-daemon
00831f1
79f4da1
Name:           %{sname}
c08f4d2
Version:        5.13.49
a9ae664
Release:        %autorelease
00831f1
Summary:        Daemon handling the DDE session settings
00831f1
License:        GPLv3
00831f1
URL:            https://github.com/linuxdeepin/dde-daemon
00831f1
Source0:        %{url}/archive/%{version}/%{repo}-%{version}.tar.gz
2254edb
# upstream default mono font set to 'Noto Mono', which is not yet available in
2254edb
# Fedora. We change to 'Noto Sans Mono'
2254edb
Source1:        fontconfig.json
79f4da1
Source2:        %{sname}.sysusers
79f4da1
059f948
# feat(image_effect): run `dde-pixmix` under xvfb-run
79f4da1
# Author: Robin Lee <cheeselee@fedoraproject.org>
c08f4d2
Patch0001: 0001-feat-image_effect-run-dde-pixmix-under-xvfb-run.patch
88164ee
79f4da1
BuildRequires:  python3
00831f1
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}
3141915
BuildRequires:  golang(pkg.deepin.io/dde/api/dxinput) >= 3.1.26
5d13bac
BuildRequires:  golang(github.com/linuxdeepin/go-dbus-factory/org.bluez)
00831f1
BuildRequires:  golang(github.com/linuxdeepin/go-x11-client)
00831f1
BuildRequires:  golang(github.com/BurntSushi/xgb)
00831f1
BuildRequires:  golang(github.com/BurntSushi/xgbutil)
00831f1
BuildRequires:  golang(github.com/axgle/mahonia)
00831f1
BuildRequires:  golang(github.com/msteinert/pam)
00831f1
BuildRequires:  golang(github.com/nfnt/resize)
ce61a9a
BuildRequires:  golang(github.com/cryptix/wav)
00831f1
BuildRequires:  golang(gopkg.in/alecthomas/kingpin.v2)
00831f1
BuildRequires:  golang(gopkg.in/yaml.v2)
2254edb
BuildRequires:  golang(github.com/gosexy/gettext)
79f4da1
BuildRequires:  golang(github.com/jinzhu/gorm)
79f4da1
BuildRequires:  golang(github.com/jinzhu/gorm/dialects/sqlite)
79f4da1
BuildRequires:  golang(github.com/kelvins/sunrisesunset)
79f4da1
BuildRequires:  golang(github.com/rickb777/date)
79f4da1
BuildRequires:  golang(github.com/teambition/rrule-go)
79f4da1
BuildRequires:  golang(github.com/davecgh/go-spew/spew)
059f948
BuildRequires:  golang(github.com/Lofanmi/pinyin-golang/pinyin)
79f4da1
BuildRequires:  compiler(go-compiler)
79f4da1
BuildRequires:  deepin-gettext-tools
79f4da1
BuildRequires:  fontpackages-devel
79f4da1
BuildRequires:  librsvg2-tools
79f4da1
BuildRequires:  pam-devel >= 1.3.1
79f4da1
BuildRequires:  glib2-devel
79f4da1
BuildRequires:  gtk3-devel
79f4da1
BuildRequires:  systemd-devel
79f4da1
BuildRequires:  alsa-lib-devel
79f4da1
BuildRequires:  pulseaudio-libs-devel
79f4da1
BuildRequires:  gdk-pixbuf2-xlib-devel
79f4da1
BuildRequires:  libnl3-devel
79f4da1
BuildRequires:  libgudev-devel
79f4da1
BuildRequires:  libinput-devel
79f4da1
BuildRequires:  librsvg2-devel
79f4da1
BuildRequires:  libXcursor-devel
79f4da1
BuildRequires:  pkgconfig(sqlite3)
c08f4d2
BuildRequires:  python3-gobject
c08f4d2
BuildRequires:  NetworkManager-libnm-devel
00831f1
94d77d3
Requires:       bamf-daemon
94d77d3
Requires:       bluez-obexd
94d77d3
Requires:       gnome-keyring
00831f1
Requires:       deepin-desktop-base
00831f1
Requires:       deepin-desktop-schemas
79f4da1
Requires:       deepin-session-ui
5d13bac
Requires:       deepin-polkit-agent
79f4da1
Requires:       rfkill
00831f1
Requires:       gvfs
00831f1
Requires:       iw
059f948
Requires:       %{_bindir}/xvfb-run
c08f4d2
Requires:       lightdm
c08f4d2
Requires:       xsettingsd
79f4da1
75c19b7
Recommends:     lshw
00831f1
Recommends:     iso-codes
5d13bac
Recommends:     imwheel
06de64f
Recommends:     %{_bindir}/xmodmap
00831f1
Recommends:     mobile-broadband-provider-info
79f4da1
Recommends:     google-noto-mono-fonts
00831f1
Recommends:     google-noto-sans-fonts
79f4da1
Recommends:     google-noto-sans-mono-fonts
00831f1
00831f1
%description
00831f1
Daemon handling the DDE session settings
00831f1
00831f1
%prep
79f4da1
%autosetup -p1 -n %{repo}-%{version}
059f948
patch langselector/locale.go < rpm/locale.go.patch
00831f1
00831f1
# Fix library exec path
ce61a9a
sed -i '/deepin/s|lib|libexec|' Makefile
2d72bf1
sed -i '/systemd/s|lib|usr/lib|' Makefile
79f4da1
sed -i 's:/lib/udev/rules.d:%{_udevrulesdir}:' Makefile
79f4da1
sed -i '/${DESTDIR}\/usr\/lib\/deepin-daemon\/service-trigger/s|${DESTDIR}/usr/lib/deepin-daemon/service-trigger|${DESTDIR}/usr/libexec/deepin-daemon/service-trigger|g' Makefile
79f4da1
sed -i '/${DESTDIR}${PREFIX}\/lib\/deepin-daemon/s|${DESTDIR}${PREFIX}/lib/deepin-daemon|${DESTDIR}${PREFIX}/usr/libexec/deepin-daemon|g' Makefile
00831f1
sed -i 's|lib/NetworkManager|libexec|' network/utils_test.go
79f4da1
79f4da1
for file in $(grep "/usr/lib/deepin-daemon" * -nR |awk -F: '{print $1}')
79f4da1
do
75c19b7
    sed -i 's|/usr/lib/deepin-daemon|%{_libexecdir}/deepin-daemon|g' $file
75c19b7
done
75c19b7
for file in $(grep "/usr/lib/deepin-api" * -nR |awk -F: '{print $1}')
75c19b7
do
75c19b7
    sed -i 's|/usr/lib/deepin-api|%{_libexecdir}/deepin-api|g' $file
79f4da1
done
00831f1
00831f1
# Fix grub.cfg path
98d9092
sed -i 's|boot/grub|boot/grub2|' grub2/{grub2,grub_params,theme}.go
00831f1
5d13bac
# Fix activate services failed (Permission denied)
5d13bac
# dbus service
5d13bac
pushd misc/system-services/
5d13bac
sed -i '$aSystemdService=deepin-accounts-daemon.service' com.deepin.system.Power.service \
5d13bac
    com.deepin.daemon.{Accounts,Apps,Daemon}.service \
5d13bac
    com.deepin.daemon.{Gesture,SwapSchedHelper,Timedated}.service
5d13bac
sed -i '$aSystemdService=dbus-com.deepin.dde.lockservice.service' com.deepin.dde.LockService.service
5d13bac
popd
5d13bac
# systemd service
5d13bac
cat > misc/systemd/services/dbus-com.deepin.dde.lockservice.service <
5d13bac
[Unit]
5d13bac
Description=Deepin Lock Service
5d13bac
Wants=user.slice dbus.socket
5d13bac
After=user.slice dbus.socket
5d13bac
5d13bac
[Service]
5d13bac
Type=dbus
5d13bac
BusName=com.deepin.dde.LockService
79f4da1
ExecStart=%{_libexecdir}/%{sname}/dde-lockservice
5d13bac
5d13bac
[Install]
5d13bac
WantedBy=graphical.target
5d13bac
EOF
5d13bac
89fe4ac
# Replace reference of google-chrome to chromium-browser
89fe4ac
sed -i 's/google-chrome/chromium-browser/g' misc/dde-daemon/mime/data.json
89fe4ac
00831f1
%build
88164ee
export GOPATH="$(pwd)/gopath:%{gopath}"
059f948
export %{gomodulesmode}
c08f4d2
%make_build -C network/nm_generator gen-nm-code
88164ee
# build different golang binaries with different build-id
88164ee
make prepare
88164ee
for cmd in bin/* ; do
88164ee
  if ! [ -f $cmd/main.c ]; then
88164ee
    %gobuild -o out/bin/$(basename $cmd) pkg.deepin.io/dde/daemon/$cmd
88164ee
  fi
88164ee
done
c08f4d2
BUILDID="0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')"
79f4da1
%make_build GO_BUILD_FLAGS=-trimpath GOBUILD="go build -compiler gc -ldflags \"-B $BUILDID\""
00831f1
00831f1
%install
2254edb
BUILDID="0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')"
79f4da1
export GOPATH="$(pwd)/build:%{gopath}"
059f948
export %{gomodulesmode}
059f948
%make_install GOBUILD="go build -compiler gc -ldflags \"-B $BUILDID\""
79f4da1
79f4da1
install -Dm644 %{SOURCE2} %{buildroot}/usr/lib/sysusers.d/%{name}.conf
00831f1
00831f1
# fix systemd/logind config
00831f1
install -d %{buildroot}/usr/lib/systemd/logind.conf.d/
79f4da1
cat > %{buildroot}/usr/lib/systemd/logind.conf.d/10-%{sname}.conf <
00831f1
[Login]
00831f1
HandlePowerKey=ignore
00831f1
HandleSuspendKey=ignore
00831f1
EOF
00831f1
00831f1
# install default settings
2254edb
install -Dm644 %{SOURCE1} \
00831f1
    %{buildroot}%{_datadir}/deepin-default-settings/fontconfig.json
00831f1
00831f1
%find_lang %{repo}
00831f1
00831f1
%post
00831f1
if [ $1 -ge 1 ]; then
79f4da1
  systemd-sysusers %{sname}.conf
00831f1
  %{_sbindir}/alternatives --install %{_bindir}/x-terminal-emulator \
79f4da1
    x-terminal-emulator %{_libexecdir}/%{sname}/default-terminal 30
00831f1
fi
00831f1
00831f1
%preun
00831f1
if [ $1 -eq 0 ]; then
00831f1
  %{_sbindir}/alternatives --remove x-terminal-emulator \
79f4da1
    %{_libexecdir}/%{sname}/default-terminal
00831f1
fi
00831f1
00831f1
%postun
00831f1
if [ $1 -eq 0 ]; then
00831f1
  rm -f /var/cache/deepin/mark-setup-network-services
00831f1
  rm -f /var/log/deepin.log 
00831f1
fi
00831f1
00831f1
%files -f %{repo}.lang
00831f1
%doc README.md
00831f1
%license LICENSE
2d72bf1
%{_sysconfdir}/pam.d/deepin-auth-keyboard
c08f4d2
%{_sysconfdir}/lightdm/deepin/
79f4da1
%{_sysconfdir}/NetworkManager/conf.d/deepin.dde.daemon.conf
79f4da1
%{_libexecdir}/%{sname}/
79f4da1
%{_prefix}/lib/systemd/logind.conf.d/10-%{sname}.conf
00831f1
%{_datadir}/dbus-1/services/*.service
00831f1
%{_datadir}/dbus-1/system-services/*.service
00831f1
%{_datadir}/dbus-1/system.d/*.conf
07b789b
%{_datadir}/icons/hicolor/*/status/*
00831f1
%{_datadir}/%{repo}/
00831f1
%{_datadir}/dde/
00831f1
%{_datadir}/polkit-1/actions/*.policy
2d72bf1
%{_var}/lib/polkit-1/localauthority/10-vendor.d/com.deepin.daemon.Accounts.pkla
79f4da1
%{_sysconfdir}/acpi/actions/deepin_lid.sh
79f4da1
%{_sysconfdir}/acpi/events/deepin_lid
79f4da1
# This directory is not provided by any other package.
79f4da1
%dir %{_sysconfdir}/pulse/daemon.conf.d
79f4da1
%{_sysconfdir}/pulse/daemon.conf.d/10-deepin.conf
79f4da1
%{_udevrulesdir}/80-deepin-fprintd.rules
79f4da1
%{_var}/lib/polkit-1/localauthority/10-vendor.d/com.deepin.daemon.Fprintd.pkla
79f4da1
%{_unitdir}/dbus-com.deepin.dde.lockservice.service
79f4da1
%{_unitdir}/deepin-accounts-daemon.service
79f4da1
%{_sysusersdir}/%{name}.conf
79f4da1
%{_datadir}/deepin-default-settings/
79f4da1
%exclude %{_sysconfdir}/default/grub.d/10_deepin.cfg
79f4da1
%exclude %{_sysconfdir}/grub.d/35_deepin_gfxmode
79f4da1
%exclude %{_libexecdir}/%{name}/grub2
79f4da1
%exclude %{_datadir}/dbus-1/system-services/com.deepin.daemon.Grub2.service
79f4da1
%exclude %{_datadir}/dbus-1/system.d/com.deepin.daemon.Grub2.conf
79f4da1
%exclude %{_datadir}/polkit-1/actions/com.deepin.daemon.Grub2.policy
2254edb
%exclude %{_var}/lib/polkit-1/localauthority/10-vendor.d/com.deepin.daemon.Grub2.pkla
00831f1
00831f1
%changelog
a9ae664
%autochangelog