Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.73 KB | None | 0 0
  1. # This file should be %%included into a device specific spec file
  2. # where macros are defined:
  3. # device: should be the CM codename
  4. # vendor: determine the directory used for ./device/<vendor>/<device>
  5. # device_pretty: User-visible model name of the device
  6. # vendor_pretty: User-visible manufacturer name of the device
  7. # hadk_make_target: the target used when running make in the HABUILD_SDK on the OBS. Defaults to "hybris-hal"
  8.  
  9. %define __provides_exclude_from ^%{_libexecdir}/droid-hybris/.*$
  10. %define android_root .
  11. %define rel_date %(date +'%%Y%%m%%d%%H%%M')
  12.  
  13. # On the OBS this package should be built in the i486 scheduler against
  14. # mer/sailfish *_i486 targets.
  15. # The prjconf should have an ExportFilter like this (mer/sailfish has this):
  16. # ExportFilter: \.armv7hl\.rpm$ armv8el
  17. # We lie about our architecture and allows OBS to cross-publish this 486 cross-built spec to the armv7hl repos
  18. %define _target_cpu armv7hl
  19.  
  20. # Support build info extracted from OBS builds too
  21. %if 0%{?_obs_build_project:1}
  22. %define _build_flavour %(echo %{_obs_build_project} | awk -F : '{if (NF == 3) print $3; else if (NF == 2) print strdevel; else print strunknown}' strdevel=devel strunknown=unknown)
  23. %else
  24. %define _build_flavour unknown
  25. %endif
  26.  
  27. %define _obs_build_count %(echo %{release} | awk -F . '{if (NF >= 3) print $3; else print $1 }')
  28. %define _obs_commit_count %(echo %{release} | awk -F . '{if (NF >= 2) print $2; else print $1 }')
  29.  
  30. %if %{_build_flavour} == release
  31. %define _version_appendix (%{_target_cpu})
  32. %else
  33. %define _version_appendix (%{_target_cpu},%{_build_flavour})
  34. %endif
  35.  
  36. %define board_mapping_dir %{_datadir}/ssu/board-mappings.d
  37. %define board_mapping_file %{board_mapping_dir}/05-%{vendor}-%{device}.ini
  38.  
  39. # Don't run strip
  40. %define __strip /bin/true
  41.  
  42. Summary: Droid HAL package for %{device}
  43. License: BSD-3-Clause
  44. Name: droid-hal-%{device}
  45. Version: 0.0.6
  46. Release: %{rel_date}
  47. Provides: droid-hal
  48. Provides: flash-partition
  49. # The repo sync service on OBS prepares a 'source tarball' of the rpm
  50. # dir since we currently have a complex setup with subdirs which OBS
  51. # doesn't like. This is not a problem for local builds.
  52. Source0: rpm.tar.bzip2
  53. Source1: makefstab
  54. Source2: usergroupgen.c
  55. Source3: makeudev
  56. Source4: apply-permissions.c
  57. Source5: makefile
  58. Source7: device-%{vendor}-%{device}-configs
  59. Source8: hybris.conf
  60. Source10: droid-hal-device.inc
  61. # This is copied from libhybris and should be kept in-sync:
  62. Source11: extract-headers.sh
  63. Source12: init-debug
  64. # This is not copied from libhybris and should not be kept in-sync:
  65. Source13: device-configs-all
  66. Source14: droid.kmap
  67. Source15: us.kmap
  68. # Ths actual droid source from the repo service when run on OBS.
  69. # local builds don't mind if this is missing
  70. Source40: repo.tar.bzip2
  71. # Reserve Source50 onwards
  72. # Allow device specific sources to be defined using dhd_sources
  73. %{?dhd_sources}
  74.  
  75. Group: System
  76. #BuildArch: noarch
  77. # Note that oneshot is not in mer-core (yet)
  78. BuildRequires: oneshot
  79. BuildRequires: systemd
  80. BuildRequires: qt5-qttools-kmap2qmap >= 5.1.0+git5
  81. BuildRequires: repomd-pattern-builder
  82. # These are only required if building on OBS
  83. %if 0%{?_obs_build_project:1}
  84. BuildRequires: ubu-trusty
  85. BuildRequires: sudo-for-abuild
  86. %endif
  87. %systemd_requires
  88. %{_oneshot_requires_post}
  89.  
  90. %description
  91. %{summary}.
  92.  
  93. ################
  94. %package devel
  95. Group: Development/Tools
  96. # Requires: %%{name} = %%{version}-%%{release}
  97. Provides: droid-hal-devel
  98. Summary: Development files for droid-hal device: %{device}
  99.  
  100. %description devel
  101. Device specific droid headers for %{device}.
  102. Needed by libhybris
  103.  
  104. ################
  105. %package sailfish-config
  106. Provides: droid-hal-sailfish-config
  107. Group: System
  108. BuildArch: noarch
  109. Requires: %{name} = %{version}-%{release}
  110. Requires: oneshot
  111. Requires: dconf
  112. Summary: Per device configuration for sailfish for droid-hal device: %{device}
  113.  
  114. %description sailfish-config
  115. Configure sailfish eg naturally landscape devices like mako
  116.  
  117. ################
  118. %package kernel
  119. Provides: droid-hal-kernel
  120. Group: System
  121. Summary: Kernel for droid-hal device: %{device}
  122.  
  123. %description kernel
  124. Just the kernel - mainly useful if you want to make a custom img
  125.  
  126. ################
  127. %package kernel-modules
  128. Provides: droid-hal-kernel-modules
  129. Requires: kmod
  130. Group: System
  131. Summary: Kernel modules for droid-hal device: %{device}
  132.  
  133. %description kernel-modules
  134. Just the kernel modules
  135.  
  136. ################
  137. %package img-boot
  138. Provides: droid-hal-img-boot
  139. Group: System
  140. Requires: flash-partition
  141. Requires: oneshot
  142. %{_oneshot_requires_post}
  143. Summary: Boot img for droid-hal device: %{device}
  144.  
  145. %description img-boot
  146. The boot.img for device
  147.  
  148. ################
  149. %package img-recovery
  150. Provides: droid-hal-img-recovery
  151. Group: System
  152. BuildArch: noarch
  153. Summary: Recovery image for droid-hal device: %{device}
  154.  
  155. %description img-recovery
  156. The recovery.img for device
  157.  
  158. ################
  159. %package pulseaudio-settings
  160. Summary: PulseAudio settings for %{device} hw
  161. Requires: pulseaudio >= 4.0
  162. Requires: pulseaudio-modules-nemo-parameters >= 4.0.11
  163. Requires: pulseaudio-modules-nemo-stream-restore >= 4.0.11
  164. Requires: pulseaudio-modules-nemo-mainvolume >= 4.0.11
  165. Requires: pulseaudio-modules-droid >= 4.0.6
  166. Requires: pulseaudio-policy-enforcement >= 4.0.8
  167. Provides: pulseaudio-settings
  168.  
  169. %description pulseaudio-settings
  170. %{summary}.
  171.  
  172. ################
  173. %package policy-settings
  174. Summary: Policy settings for %{device} hw
  175. Requires: ohm >= 1.1.16
  176. Requires: ohm-plugins-misc
  177. Requires: ohm-plugins-dbus
  178. Requires: ohm-plugin-telephony
  179. Requires: ohm-plugin-signaling
  180. Requires: ohm-plugin-media
  181. Requires: ohm-plugin-accessories
  182. Requires: ohm-plugin-resolver
  183. Requires: ohm-plugin-ruleengine
  184. Requires: ohm-plugin-profile
  185. Requires: pulseaudio-modules-nemo-common >= 4.0.11
  186. Requires: pulseaudio-policy-enforcement >= 4.0.8
  187. Requires: policy-settings-common >= 0.2.0
  188. Obsoletes: ohm-config <= 1.1.15
  189. # ohm-configs-default should not be installed ever, thus no version
  190. # specification defined here.
  191. Obsoletes: ohm-configs-default
  192. Provides: ohm-configs > 1.1.15
  193. Provides: policy-settings
  194.  
  195. %description policy-settings
  196. %{summary}.
  197.  
  198. ################
  199. %package kickstart-configuration
  200. Summary: Kickstart configuration for %{device}
  201. Requires: ssu-kickstart-configuration-jolla
  202. Provides: droid-hal-kickstart-configuration
  203.  
  204. %description kickstart-configuration
  205. %{summary}.
  206.  
  207. ################
  208.  
  209. %package preinit-plugin
  210. Summary: Preinit plugins for %{device}
  211. Provides: preinit-plugins
  212.  
  213. %description preinit-plugin
  214. %{summary}.
  215.  
  216. ################################################################
  217. %package patterns
  218. Summary: Repository patterns for %{device} hw
  219. Provides: package-groups
  220.  
  221. %description patterns
  222. %{summary}.
  223.  
  224. ################################################################
  225. # Begin prep/build section
  226.  
  227. %prep
  228. # No %%setup macro !!
  229.  
  230. %if 0%{?_obs_build_project:1}
  231. # The OBS does not have access to 'repo' so a service does the repo init/sync
  232. # and provides a (huge) tarball with the checked-out tree in it.
  233. # So now drop to android_root and pretend to do a repo sync
  234. tar xf %{SOURCE40} -C %android_root
  235. # Clean up the repo tarball to save space
  236. rm -f %{SOURCE40}
  237. # Make a dummy tarball for rpm checks
  238. mkdir dummy;(cd dummy; touch dummy; tar cvf - . | bzip2 > %{SOURCE40}); rm -rf dummy
  239. # unpack the directories to SOURCES ... this needs to change
  240. tar xf %{SOURCE0} -C ../SOURCES
  241. # Clean up the rpm tarball too
  242. rm -f %{SOURCE0}
  243. cp %{SOURCE40} %{SOURCE0}
  244.  
  245. # In OBS the repo service leaves the rpm/* files for OBS and they just ^^
  246. # got unpacked to ../SOURCES ... but we're used to having an rpm/ dir
  247. # So if rpm/ is missing then we use ../SOURCES :
  248. [ -d rpm ] || ln -s ../SOURCES rpm
  249. %endif
  250.  
  251. %build
  252.  
  253. %if 0%{?_obs_build_project:1}
  254. # Hadk style build of android on OBS
  255. echo Running droid build in HABUILD_SDK
  256. ubu-chroot -r /srv/mer/sdks/ubu "cd %android_root; source build/envsetup.sh; breakfast %{device}; rm -f .repo/local_manifests/roomservice.xml; make %{?_smp_mflags} %{?hadk_make_target}%{!?hadk_make_target:hybris-hal}"
  257. %endif
  258.  
  259. # Make a tmp location for built installables
  260. rm -rf tmp
  261. mkdir tmp
  262.  
  263. echo Verifying kernel config
  264. hybris/mer-kernel-check/mer_verify_kernel_config \
  265. %{android_root}/out/target/product/%{device}/obj/KERNEL_OBJ/.config
  266.  
  267. echo Building local tools
  268. mkdir tmp/rpmsrc
  269. cp %{SOURCE2} %{SOURCE4} tmp/rpmsrc/
  270. ANDROID_ROOT=$(readlink -e %{android_root})
  271. (cd tmp/rpmsrc; make ANDROID_ROOT=$ANDROID_ROOT -f %{SOURCE5})
  272.  
  273. echo Building uid scripts
  274. tmp/rpmsrc/usergroupgen add > tmp/rpmsrc/droid-user-add.sh
  275. tmp/rpmsrc/usergroupgen remove > tmp/rpmsrc/droid-user-remove.sh
  276.  
  277. echo Building udev rules
  278. mkdir tmp/udev.rules
  279. # Device specific ueventd rules is the "not goldfish" one
  280. chmod 755 %{SOURCE3}
  281. %{SOURCE3} \
  282. %{android_root}/out/target/product/%{device}/root/ueventd.rc \
  283. $(ls %{android_root}/out/target/product/%{device}/root/ueventd.*.rc | grep -v .goldfish.rc) \
  284. > tmp/udev.rules/999-android-system.rules
  285.  
  286. echo Building mount units
  287. mkdir tmp/units
  288. # Use the makefstab and tell it what mountpoints to skip. It will
  289. # generate .mount units which will be part of local-fs.target
  290. # skip various mounts which are not wanted (This is just in case they creep in)
  291. # First handle stupid spec quoting rules to get some args for makefstab
  292. shopt -s nullglob
  293. FSTAB_FILES="$(echo %{android_root}/out/target/product/%{device}/root/fstab.* %{android_root}/out/target/product/%{device}/root/*.rc)"
  294. shopt -u nullglob
  295.  
  296. chmod 755 %{SOURCE1}
  297. %{SOURCE1} --files $FSTAB_FILES --skip auto /acct /boot /cache /data /misc /recovery /staging /storage/usbdisk /sys/fs/cgroup /sys/fs/cgroup/memory /sys/kernel/debug /sys/kernel/config --outputdir tmp/units
  298.  
  299. echo Fixing up mount points
  300. hybris/hybris-boot/fixup-mountpoints %{device} tmp/units/*
  301.  
  302. echo Creating hw-release
  303. # based on http://www.freedesktop.org/software/systemd/man/os-release.html
  304. cat > tmp/hw-release <<EOF
  305. # This file is copied as both hw-release (analogous to os-release)
  306. # and hw-release.vars for use at build time
  307. MER_HA_DEVICE=%{device}
  308. MER_HA_VENDOR=%{vendor}
  309. MER_HA_VERSION="%{version}.%{_obs_build_count} %{_version_appendix}"
  310. MER_HA_VERSION_ID=%{version}.%{_obs_build_count}
  311. MER_HA_PRETTY_NAME="%{device} %{version}.%{_obs_build_count} %{_version_appendix}"
  312. MER_HA_SAILFISH_BUILD=%{_obs_build_count}
  313. MER_HA_SAILFISH_FLAVOUR=%{_build_flavour}
  314. MER_HA_HOME_URL="https://sailfishos.org/"
  315. EOF
  316.  
  317. # Grab a snapshot of the git state from repo
  318. if [ -e ./repo_service_manifest.xml ] ; then
  319. # The OBS service helpfully dropped a repo manifest file here:
  320. mv ./repo_service_manifest.xml tmp/manifest.xml
  321. else
  322. ./.repo/repo/repo manifest -r -o tmp/manifest.xml
  323. fi
  324.  
  325. ################
  326. %install
  327. echo install $(cat tmp/units/all-units.txt)
  328. rm -rf $RPM_BUILD_ROOT
  329. # Create dir structure
  330. mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/droid-hybris/lib-dev-alog/
  331. mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/droid-hybris/system
  332. mkdir -p $RPM_BUILD_ROOT%{_libdir}/droid
  333. mkdir -p $RPM_BUILD_ROOT%{_libdir}/droid-devel/
  334. mkdir -p $RPM_BUILD_ROOT%{_unitdir}
  335. mkdir -p $RPM_BUILD_ROOT/lib/udev/rules.d
  336. mkdir -p $RPM_BUILD_ROOT/etc/udev/rules.d
  337. mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/environment/compositor
  338. mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/environment/nemo
  339. mkdir -p $RPM_BUILD_ROOT/%{_oneshotdir}
  340. mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/os-release.d
  341.  
  342. mkdir -p $RPM_BUILD_ROOT%{_libdir}/modules/
  343. mkdir -p $RPM_BUILD_ROOT%{_libdir}/droid
  344. mkdir -p $RPM_BUILD_ROOT/%{_bindir}/droid
  345.  
  346. mkdir -p $RPM_BUILD_ROOT/img
  347. mkdir -p $RPM_BUILD_ROOT/boot
  348. mkdir -p $RPM_BUILD_ROOT/lib/modules
  349. mkdir -p $RPM_BUILD_ROOT%{_libdir}/startup/preinit
  350.  
  351. # Install
  352. cp -a %{android_root}/out/target/product/%{device}/system/bin/updater $RPM_BUILD_ROOT/boot/update-binary
  353. cp -a %{android_root}/out/target/product/%{device}/hybris-updater-script $RPM_BUILD_ROOT/boot
  354. cp -a %{android_root}/out/target/product/%{device}/hybris-updater-unpack.sh $RPM_BUILD_ROOT/boot
  355.  
  356. cp -a %{android_root}/out/target/product/%{device}/root/. $RPM_BUILD_ROOT/
  357.  
  358. # Now remove the mount commands from any .rc files as they're included in .mount unit files now
  359. sed -i -e '/^[[:space:]]*mount[[:space:]]/s/^/# Removed during droid-hal-device build : /' $RPM_BUILD_ROOT/*rc
  360.  
  361. cp -a %{android_root}/out/target/product/%{device}/system/{bin,lib} $RPM_BUILD_ROOT%{_libexecdir}/droid-hybris/system/.
  362. cp -a %{android_root}/out/target/product/%{device}/obj/{lib,include} $RPM_BUILD_ROOT%{_libdir}/droid-devel/
  363. cp -a %{android_root}/out/target/product/%{device}/symbols $RPM_BUILD_ROOT%{_libdir}/droid-devel/
  364.  
  365. HDRS=$RPM_BUILD_ROOT%{_libdir}/droid-devel/droid-headers
  366. mkdir -p $HDRS
  367.  
  368. # Store the 'as built' manifest
  369. cp tmp/manifest.xml $HDRS/repo-manifest.xml
  370.  
  371. # Run extract-headers.sh
  372. echo "Extracting headers for hybris"
  373. chmod 755 %SOURCE11
  374. %SOURCE11 -p %{_libdir}/droid-devel/droid-headers . $HDRS/ > /dev/null
  375.  
  376. # Add our config into the default android-config.h
  377. echo Making new $HDRS/android-config.h
  378. sed '/CONFIG GOES HERE/,$d' $HDRS/android-config.h > $HDRS/android-config.h.new
  379. cat <<EOF >> $HDRS/android-config.h.new
  380. /* Added by Droid HAL packaging for %{device} */
  381. %{?android_config}
  382. EOF
  383. sed '0,/CONFIG GOES HERE/d' $HDRS/android-config.h >> $HDRS/android-config.h.new
  384. mv $HDRS/android-config.h.new $HDRS/android-config.h
  385.  
  386. # Move the pkgconfig .pc to the correct location
  387. mkdir -p $RPM_BUILD_ROOT%{_libdir}/pkgconfig/
  388. mv $HDRS/android-headers.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/
  389.  
  390. # If this ever becomes unmanageable then
  391. # grep -l dev/alog %%{android_root}/out/target/product/%{device}/system/lib/*
  392. # libdsyscalls.so and libc.so are blacklisted
  393. ln -s ../system/lib/{liblog.so,libcutils.so} $RPM_BUILD_ROOT%{_libexecdir}/droid-hybris/lib-dev-alog/.
  394.  
  395. cp -a tmp/units/*.mount $RPM_BUILD_ROOT/%{_unitdir}
  396. cp -a rpm/dsp/systemd/* $RPM_BUILD_ROOT/%{_unitdir}
  397.  
  398. # Install the udev rules and supporting script
  399. cp -a tmp/udev.rules/* $RPM_BUILD_ROOT/lib/udev/rules.d/
  400. ln -s /dev/null $RPM_BUILD_ROOT/etc/udev/rules.d/60-persistent-v4l.rules
  401.  
  402. # Install init-debug which will provide usb access and non-blocking telnet
  403. cp -a %{SOURCE12} $RPM_BUILD_ROOT/
  404.  
  405. # droid user support This may be better done by passing a list of
  406. # users/groups and running 'ensure_usergroups_exist newlist oldlist'
  407. # which would preserve oldlist in %%post and delete any users no longer
  408. # needed (unlikely!). This avoids the transient removal of uids and
  409. # group issues
  410. install -D tmp/rpmsrc/droid-user-add.sh $RPM_BUILD_ROOT%{_libdir}/droid/droid-user-add.sh
  411. install -D tmp/rpmsrc/droid-user-remove.sh $RPM_BUILD_ROOT%{_libdir}/droid/droid-user-remove.sh
  412.  
  413. # Add the dsp support binaries
  414. cp rpm/dsp/bin/* $RPM_BUILD_ROOT/%{_bindir}/droid
  415.  
  416. # Preinit plugins
  417. install -m 0744 rpm/dsp/preinit/* $RPM_BUILD_ROOT%{_libdir}/startup/preinit/
  418. ln -s /bin/false $RPM_BUILD_ROOT%{_libdir}/startup/preinit/is_total_erase_supported
  419.  
  420. # droid permission fixer
  421. install -D tmp/rpmsrc/apply-permissions $RPM_BUILD_ROOT%{_libdir}/droid/apply-permissions
  422.  
  423. # Remove cruft
  424. rm -f $RPM_BUILD_ROOT/fstab.*
  425. rm -f $RPM_BUILD_ROOT/*goldfish*
  426. rm -rf $RPM_BUILD_ROOT/{proc,sys,dev,sepolicy} $RPM_BUILD_ROOT/{file,property,seapp}_contexts
  427. rm -rf $RPM_BUILD_ROOT/{charger,res,data}
  428.  
  429. # Name this so droid-system-packager's droid-hal-startup.sh can find it
  430. mkdir -p $RPM_BUILD_ROOT/sbin
  431. mv $RPM_BUILD_ROOT/init $RPM_BUILD_ROOT/sbin/droid-hal-init
  432. # Rename any symlinks to droid's /init
  433. find $RPM_BUILD_ROOT/sbin/ -lname ../init -execdir echo rm {} \; -execdir echo "ln -s" ./droid-hal-init {} \;
  434. #mv $RPM_BUILD_ROOT/charger $RPM_BUILD_ROOT/sbin/droid-hal-charger
  435.  
  436. # Amalgamate configs files from device-specific and all- trees
  437. # Retain permissions:
  438. echo "%defattr(-,root,root,-)" > tmp/rpmsrc/conf.files
  439. # Add files that you will handle manually (per-device and/or per-package) to this | separated var:
  440. EXCLUDES="/var/lib/platform-updates/flash-bootimg.sh"
  441. # Prefer files from device-$VENDOR-$DEVICE-configs over device-configs-all
  442. for config_dir in %{SOURCE13} %{SOURCE7}; do
  443. if [ -d $config_dir ]; then
  444. (cd $config_dir; find . \( -type f -or -type l \) -print ) | grep -vE "$EXCLUDES" | sed 's/^.//' >> tmp/rpmsrc/conf.files
  445. cp -R $config_dir/* $RPM_BUILD_ROOT/
  446. fi
  447. done
  448.  
  449. cp %{SOURCE8} $RPM_BUILD_ROOT/%{_sharedstatedir}/environment/nemo/99-hybris.conf
  450.  
  451. # SSU board mapping for hardware adaptation
  452. mkdir -p $RPM_BUILD_ROOT/%{board_mapping_dir}
  453. sed -e 's|%DEVICE%|%{device}|g' \
  454. -e 's|%VENDOR%|%{vendor}|g' \
  455. -e "s|%DEVICE_PRETTY%|%{device_pretty}|g" \
  456. -e "s|%VENDOR_PRETTY%|%{vendor_pretty}|g" \
  457. -e "s|%ARCH%|%{__isa_name}|g" \
  458. rpm/ssu/board-mappings.d/05-sfe.ini.in >$RPM_BUILD_ROOT/%{board_mapping_file}
  459.  
  460. # Copy kickstart packs (for %%{device}-kickstart-configuration)
  461. mkdir -p $RPM_BUILD_ROOT/%{_datadir}/ssu/kickstart/pack/%{device}
  462. sed -e 's|@DEVICE@|%{device}|g' rpm/kickstart/pack/package-droid-updater > $RPM_BUILD_ROOT/%{_datadir}/ssu/kickstart/pack/%{device}/package-droid-updater
  463.  
  464. mkdir -p $RPM_BUILD_ROOT/%{_datadir}/ssu/kickstart/post_nochroot/
  465. cp rpm/kickstart/post_nochroot/hybris $RPM_BUILD_ROOT/%{_datadir}/ssu/kickstart/post_nochroot/%{device}
  466.  
  467. # and attachments
  468. mkdir -p $RPM_BUILD_ROOT/%{_datadir}/ssu/kickstart/attachment
  469. cp rpm/kickstart/attachment/hybris $RPM_BUILD_ROOT/%{_datadir}/ssu/kickstart/attachment/%{device}
  470.  
  471. # Keyboard map file
  472. /usr/lib/qt5/bin/kmap2qmap %{SOURCE14} %{SOURCE15} tmp/droid.qmap
  473. mkdir -p $RPM_BUILD_ROOT/%{_datadir}/qt5/keymaps
  474. cp tmp/droid.qmap $RPM_BUILD_ROOT/%{_datadir}/qt5/keymaps/droid.qmap
  475.  
  476. # hw-release
  477. cp tmp/hw-release %{buildroot}/%{_sysconfdir}/hw-release
  478. # for use in the -devel package
  479. cp tmp/hw-release %{buildroot}/%{_libdir}/droid-devel/hw-release.vars
  480.  
  481. # Screen rotation dconf configuration
  482. mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/dconf/db/vendor.d/locks
  483. cp rpm/dconf/screen-rotation.txt $RPM_BUILD_ROOT/%{_sysconfdir}/dconf/db/vendor.d/screen-rotation.txt
  484. cp rpm/dconf/locks-screen-rotation.txt $RPM_BUILD_ROOT/%{_sysconfdir}/dconf/db/vendor.d/locks/screen-rotation.txt
  485.  
  486. # This ghost file must exist in the installroot
  487. touch $RPM_BUILD_ROOT/%{_libdir}/droid/droid-user-remove.sh.installed
  488.  
  489. # Kernel and module installation; to
  490. # /boot and modules to /lib as normal
  491. KERNEL_RELEASE=$(cat out/target/product/%{device}/obj/KERNEL_OBJ/include/config/kernel.release)
  492. cp out/target/product/%{device}/kernel $RPM_BUILD_ROOT/boot/kernel-$KERNEL_RELEASE
  493. MOD_DIR=$RPM_BUILD_ROOT/lib/modules/$KERNEL_RELEASE
  494. mkdir -p $MOD_DIR
  495. cp -a out/target/product/%{device}/system/lib/modules/. $MOD_DIR/.
  496. cp -a out/target/product/%{device}/system/lib/modules/. $MOD_DIR/.
  497. cp -a out/target/product/%{device}/obj/KERNEL_OBJ/modules.builtin $MOD_DIR/. || true
  498. cp -a out/target/product/%{device}/obj/KERNEL_OBJ/modules.order $MOD_DIR/. || true
  499.  
  500. # Images are installed to /boot - they'll probably be unpacked using
  501. # rpm2cpio mostly anyhow
  502. cp out/target/product/%{device}/hybris-boot.img $RPM_BUILD_ROOT/boot/
  503. cp out/target/product/%{device}/hybris-recovery.img $RPM_BUILD_ROOT/boot/
  504.  
  505.  
  506. # Everything is installed; get a list of the units we installed to
  507. # allow the systemd_post to work... and then install that:
  508. echo "$(cd $RPM_BUILD_ROOT%{_unitdir}; echo *)" > tmp/units/all-units.txt
  509. install -D tmp/units/all-units.txt $RPM_BUILD_ROOT%{_libdir}/droid/all-units.txt
  510.  
  511. /usr/bin/repomd-pattern-builder.py --patternxml -p ./rpm/patterns/%{device} -o %{buildroot}/usr/share/package-groups/ --version=%{version} --release=%{release}
  512.  
  513. ################################################################
  514. # Begin pre/post section
  515.  
  516. %preun
  517. for u in $(cat %{_libdir}/droid/all-units.txt); do
  518. %systemd_preun $u
  519. done
  520. # Only run this during final cleanup
  521. if [ $1 -eq 0 ]; then
  522. echo purging old droid users and groups
  523. %{_libdir}/droid/droid-user-remove.sh.installed || :
  524. fi
  525.  
  526. %post
  527. for u in $(cat %{_libdir}/droid/all-units.txt); do
  528. %systemd_post $u
  529. done
  530. cd %{_libdir}/droid
  531. # Upgrade: remove users using stored file, then add new ones
  532. if [ $1 -eq 2 ]; then
  533. # Remove installed users (at this point droid-user-remove.sh
  534. # refers to the new set of UIDs)
  535. echo removing old droid users and groups
  536. ./droid-user-remove.sh.installed || :
  537. fi
  538. # Now for both install/update add the users and force-store a removal file
  539. echo creating droid users and groups
  540. ./droid-user-add.sh || :
  541. cp -f droid-user-remove.sh droid-user-remove.sh.installed
  542.  
  543. # Now ensure default user has access to various subsystems this HA provides
  544. # These are the default android ones:
  545. /usr/bin/groupadd-user audio || :
  546. /usr/bin/groupadd-user graphics || :
  547. /usr/bin/groupadd-user system || :
  548. /usr/bin/groupadd-user input || :
  549. /usr/bin/groupadd-user camera || :
  550. # To add additional groups define a HA config macro like android_config
  551.  
  552. %post sailfish-config
  553.  
  554. %{_bindir}/add-oneshot dconf-update || :
  555.  
  556. %post kernel-modules
  557. # This runs on the device at install or in mic chroot at img build
  558. # in chroot the kernel version is not known.
  559. for ver in $(cd /lib/modules; echo *); do
  560. /sbin/depmod $ver || :
  561. done
  562.  
  563. %if 0%{?enable_kernel_update:1}
  564. %post img-boot
  565. # This oneshot is enabled only during package upgrades, as initial
  566. # installation is done when we flash device.
  567. if [ $1 -ne 1 ] ; then
  568. add-preinit-oneshot /var/lib/platform-updates/flash-bootimg.sh
  569. fi
  570. %endif
  571.  
  572. ################################################################
  573. # Begin files section
  574.  
  575. %files -f tmp/rpmsrc/conf.files
  576. %defattr(-,root,root,-)
  577. /sbin/*
  578. %{_bindir}/droid/droid-init-done.sh
  579. %{_bindir}/droid/kill-cgroup.sh
  580. %{_bindir}/droid/droid-hal-startup.sh
  581. # This binary should probably move to /sbin/
  582. %{_libdir}/droid/droid-user-add.sh
  583. %{_libdir}/droid/droid-user-remove.sh
  584. %{_libdir}/droid/apply-permissions
  585. %{_libdir}/droid/all-units.txt
  586. %{board_mapping_file}
  587. # Created in %%post
  588. # init-debug
  589. %attr(755,root,root) /init-debug
  590. %ghost %attr(755, root, root) %{_libdir}/droid/droid-user-remove.sh.installed
  591. # droid binaries
  592. %{_libexecdir}/droid-hybris/system/bin/
  593.  
  594. # Non executable files
  595. %defattr(644,root,root,-)
  596. %{_unitdir}
  597. # hybris and /dev/alog/ libraries
  598. %{_libexecdir}/droid-hybris/system/lib/
  599. # just /dev/alog/ libraries (for trying to run pure android apps)
  600. %{_libexecdir}/droid-hybris/lib-dev-alog/.
  601. /lib/udev/rules.d/*
  602. /lib/udev/platform-device
  603. # Droid config droppings
  604. /*.rc
  605. /default.prop
  606. %{_sharedstatedir}/environment/compositor/droid-hal-device.conf
  607. %{_sharedstatedir}/environment/nemo/99-hybris.conf
  608. %{_datadir}/qt5/keymaps/droid.qmap
  609. # Hardware and build info
  610. %config %{_sysconfdir}/hw-release
  611. # Disabling v4l.rules
  612. %{_sysconfdir}/udev/rules.d/60-persistent-v4l.rules
  613.  
  614. %files devel
  615. %defattr(644,root,root,-)
  616. %{_libdir}/droid-devel/
  617. %{_libdir}/pkgconfig/*pc
  618.  
  619. %files sailfish-config
  620. %defattr(-,root,root,-)
  621. %{_sysconfdir}/dconf/db/vendor.d/screen-rotation.txt
  622. %{_sysconfdir}/dconf/db/vendor.d/locks/screen-rotation.txt
  623.  
  624. %files kernel
  625. %defattr(644,root,root,-)
  626. /boot/kernel*
  627.  
  628. %files kernel-modules
  629. %defattr(644,root,root,-)
  630. /lib/modules
  631.  
  632. %files img-boot
  633. %defattr(644,root,root,-)
  634. /boot/hybris-boot.img
  635. /boot/update-binary
  636. /boot/hybris-updater-script
  637. /boot/hybris-updater-unpack.sh
  638. %if 0%{?enable_kernel_update:1}
  639. %attr(744, root, root) /var/lib/platform-updates/flash-bootimg.sh
  640. %endif
  641.  
  642. %files img-recovery
  643. %defattr(644,root,root,-)
  644. /boot/hybris-recovery.img
  645.  
  646. %files pulseaudio-settings
  647. %defattr(644,root,root,-)
  648.  
  649. %files policy-settings
  650. %defattr(644,root,root,-)
  651.  
  652. %files kickstart-configuration
  653. %defattr(644,root,root-)
  654. %{_datadir}/ssu/kickstart/pack/%{device}/package-droid-updater
  655. %{_datadir}/ssu/kickstart/attachment/%{device}
  656. %{_datadir}/ssu/kickstart/post_nochroot/%{device}
  657.  
  658. %files patterns
  659. %defattr(-,root,root,-)
  660. %{_datadir}/package-groups/*.xml
  661.  
  662. %files preinit-plugin
  663. %defattr(-,root,root,-)
  664. %{_libdir}/startup/preinit/*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement