Generate weston.ini dynamically
[AGL/meta-agl.git] / meta-agl / recipes-graphics / wayland / weston-ini-conf.bb
1 SUMMARY = "Startup script and systemd unit file for the Weston Wayland compositor"
2 LICENSE = "MIT"
3 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
4
5 S = "${WORKDIR}"
6
7 require weston-ini-conf/screen.inc
8
9 DEFAULT_SCREEN[transform]?="90"
10 DEFAULT_SCREEN[name]?="HDMI-A-1"
11
12 WESTONCORE[shell]??="desktop-shell.so"
13 WESTONCORE[backend]??="drm-backend.so"
14
15 WESTONSHELL[locking]="true"
16 # Uncomment below to hide panel
17 #WESTONSHELL[panel-location]="none"
18
19 WESTONOUTPUT1[agl_screen]??="DEFAULT_SCREEN"
20
21 WESTONSECTION[WESTONCORE]?="core"
22 WESTONSECTION[WESTONSHELL]?="shell"
23 WESTONSECTION[WESTONOUTPUT1]?="output"
24
25 python do_generate_weston_init() {
26     with open(d.getVar('WORKDIR', True)+"/weston.ini"  ,'w') as weston_ini:
27         dicoSection=d.getVarFlags('WESTONSECTION')
28         keysSection=list(dicoSection.keys())
29         keysSection.sort()
30         for section in keysSection:
31             weston_ini.writelines( "["+dicoSection[section]+"]\n")
32             dicoSectionValues=d.getVarFlags(section)
33             keysSectionValues=list(dicoSectionValues.keys())
34             keysSectionValues.sort()
35             for sectionValue in keysSectionValues:
36                 if (dicoSection[section] == "output" and sectionValue == "agl_screen"):
37                     screen=dicoSectionValues[sectionValue]
38                     dicoScreenConfig=d.getVarFlags(screen)
39                     keysScreenConfig=list(dicoScreenConfig.keys())
40                     keysScreenConfig.sort()
41                     for screenConfig in keysScreenConfig:
42                         weston_ini.writelines( screenConfig+"="+dicoScreenConfig[screenConfig]+"\n")
43                 else:
44                     weston_ini.writelines( str(sectionValue)+"="+str(dicoSectionValues[sectionValue])+"\n")
45
46             weston_ini.writelines( "\n")
47 }
48
49 #ar_src = d.getVarFlag('ARCHIVER_MODE', 'src', True)
50
51 addtask do_generate_weston_init after do_compile before do_install
52
53 do_install_append() {
54     WESTON_INI_CONFIG=${sysconfdir}/xdg/weston
55     install -d ${D}${WESTON_INI_CONFIG}
56     install -m 0644 ${WORKDIR}/weston.ini ${D}${WESTON_INI_CONFIG}/weston.ini
57 }