Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 1 | # Common code for recipes that create IPMI provider libraries |
| 2 | |
Brad Bishop | 02f9a52 | 2018-03-09 16:51:57 -0500 | [diff] [blame] | 3 | inherit obmc-phosphor-utils |
| 4 | |
Patrick Venture | 4cdfde1 | 2018-10-03 11:27:00 -0700 | [diff] [blame] | 5 | # This LIBDIR is searched for the libraries. |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 6 | LIBDIR = "${D}/${libdir}/ipmid-providers/" |
Patrick Venture | 4cdfde1 | 2018-10-03 11:27:00 -0700 | [diff] [blame] | 7 | |
| 8 | # The symlinks are installed in the following directories depending on the |
| 9 | # variable. |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 10 | HOSTIPMI_LIBDIR = "${D}/${libdir}/host-ipmid/" |
| 11 | NETIPMI_LIBDIR = "${D}/${libdir}/net-ipmid/" |
Patrick Venture | 4cdfde1 | 2018-10-03 11:27:00 -0700 | [diff] [blame] | 12 | BLOBIPMI_LIBDIR = "${D}/${libdir}/blob-ipmid/" |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 13 | |
| 14 | python symlink_create_postinstall() { |
| 15 | def install_symlink(d, libname, install_dir): |
| 16 | import glob; |
| 17 | |
| 18 | if not os.path.exists(install_dir): |
| 19 | os.makedirs(install_dir) |
| 20 | |
| 21 | lib_dir = d.getVar('LIBDIR', True) |
| 22 | |
| 23 | # find the library extension libxxx.so.? |
| 24 | install_file = lib_dir + libname + ".?" |
| 25 | |
| 26 | filelist = glob.glob(install_file); |
| 27 | |
| 28 | # get the library name |
| 29 | path, file = os.path.split(filelist[0]) |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 30 | source = "../ipmid-providers/" + file |
| 31 | |
| 32 | # create the symlink |
Brad Bishop | 66f1f9f | 2018-02-14 22:24:55 -0500 | [diff] [blame] | 33 | os.symlink(source, os.path.join(install_dir, file)) |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 34 | |
| 35 | for libname in listvar_to_list(d, 'HOSTIPMI_PROVIDER_LIBRARY'): |
| 36 | install_dir = d.getVar('HOSTIPMI_LIBDIR', True) |
| 37 | install_symlink(d, libname, install_dir) |
| 38 | |
| 39 | for libname in listvar_to_list(d, 'NETIPMI_PROVIDER_LIBRARY'): |
| 40 | install_dir = d.getVar('NETIPMI_LIBDIR', True) |
| 41 | install_symlink(d, libname, install_dir) |
Patrick Venture | 4cdfde1 | 2018-10-03 11:27:00 -0700 | [diff] [blame] | 42 | |
| 43 | for libname in listvar_to_list(d, 'BLOBIPMI_PROVIDER_LIBRARY'): |
| 44 | install_dir = d.getVar('BLOBIPMI_LIBDIR', True) |
| 45 | install_symlink(d, libname, install_dir) |
Tom Joseph | dcdc8ea | 2017-02-01 19:47:27 +0530 | [diff] [blame] | 46 | } |
Brad Bishop | 8e5d45b | 2018-02-14 22:24:02 -0500 | [diff] [blame] | 47 | do_install[postfuncs] += "symlink_create_postinstall" |