xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 1 | inherit externalsrc package systemd |
| 2 | |
| 3 | DESCRIPTION = "autosuspend.service" |
| 4 | |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 5 | LICENSE = "MobileTekProprietary" |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=44d8d2b6296ca24bcd4894bb7155bf27" |
| 7 | |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 8 | SRC_URI = "file://autosuspend.c file://LICENSE \ |
| 9 | file://autosuspend.h \ |
| 10 | file://autosuspend_ops.h \ |
| 11 | file://autosuspend_wakeup_count.c \ |
| 12 | file://main.c \ |
| 13 | file://autosuspend.service \ |
| 14 | file://lynq-autosuspend.sh \ |
| 15 | file://makefile \ |
| 16 | " |
| 17 | |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 18 | EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'" |
| 19 | |
| 20 | TARGET_CC_ARCH += "${LDFLAGS}" |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 21 | |
| 22 | LOCAL_C_INCLUDES = "-I. " |
| 23 | |
| 24 | DEPENDS = "liblynq-log liblynq-uci" |
| 25 | DEPENDS += "${@bb.utils.contains('TARGET_PLATFORM', 'mt2735', 'audio-mixer-ctrl streamer1.0', '', d)} liblynq-log liblynq-uci libbsp libsctel libatutils libatreg liblynq-sim" |
| 26 | LOCAL_LIBS = "-L. -ldl -lstdc++ -lpthread -llog" |
| 27 | SOURCES = "$(wildcard *.c )" |
| 28 | |
| 29 | OBJECTS = "$(SOURCES:.c=.o)" |
| 30 | |
| 31 | EXECUTABLE = "autosuspend" |
| 32 | S = "${WORKDIR}" |
| 33 | TARGET_CC_ARCH += "${LDFLAGS}" |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 34 | SYSTEMD_PACKAGES = "${PN}" |
| 35 | SYSTEMD_SERVICE_${PN} = "autosuspend.service" |
| 36 | FILES_${PN} += "${systemd_unitdir}/system/autosuspend.service" |
| 37 | #INHIBIT_PACKAGE_STRIP = "1" |
| 38 | do_compile () { |
| 39 | |
| 40 | #${CXX} -Wall ${LOCAL_C_INCLUDES} autosuspend.c autosuspend_wakeup_count.c main.c ${LOCAL_LIBS} -o ${EXECUTABLE} |
| 41 | if test "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" || test "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4"; then |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 42 | oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -mhard-float" |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 43 | else |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 44 | oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}" |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 45 | fi |
| 46 | } |
| 47 | |
| 48 | do_install() { |
| 49 | install -d ${D}${bindir}/ |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 50 | echo "Installing image PN ${PN}" |
| 51 | echo "Installing image systemd_unitdir ${systemd_unitdir}" |
| 52 | echo "Installing image D ${D}" |
| 53 | echo "Installing image B ${B}" |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 54 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
| 55 | install -d ${D}${systemd_unitdir}/system/ |
| 56 | install -m 0644 ${B}/autosuspend.service ${D}${systemd_unitdir}/system |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 57 | else |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 58 | install -d ${D}${sysconfdir}/init.d |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 59 | install -m 0755 ${S}/lynq-autosuspend.sh ${D}${sysconfdir}/init.d/ |
| 60 | install -d ${D}${sysconfdir}/rcS.d |
| 61 | ln -s ../init.d/lynq-autosuspend.sh ${D}${sysconfdir}/rcS.d/S82lynq-autosuspend-service |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 62 | fi |
| 63 | |
xf.li | a06dd22 | 2024-10-14 09:07:20 +0000 | [diff] [blame] | 64 | install -m 0755 ${S}/autosuspend ${D}${bindir}/ |
| 65 | install -d ${D}${includedir} |
xf.li | 3dd5374 | 2024-09-27 00:06:23 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |