Changeset 5852a5a in mainline


Ignore:
Timestamp:
2019-08-17T12:49:43Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d63c842
Parents:
1ef3213
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-06-27 14:27:29)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-08-17 12:49:43)
Message:

more uniform handling of custom install

Location:
uspace
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/meson.build

    r1ef3213 r5852a5a  
    4545
    4646# TODO: install this file somewhere sane
    47 install_data('demo.txt', install_dir: '/')
     47installed_data += { 'name': 'demo.txt', 'dir': '/' }
  • uspace/app/modplay/meson.build

    r1ef3213 r5852a5a  
    44if install_nonessential_data
    55        # TODO: install this file somewhere sane
    6         install_data('demo.xm', install_dir: '/')
     6        installed_data += { 'name': 'demo.xm', 'dir': '/' }
    77endif
  • uspace/app/viewer/meson.build

    r1ef3213 r5852a5a  
    44if install_nonessential_data
    55        # TODO: install this file somewhere sane
    6         install_data('logo.tga', install_dir: '/')
     6        installed_data += { 'name': 'logo.tga', 'dir': '/' }
    77endif
  • uspace/app/wavplay/meson.build

    r1ef3213 r5852a5a  
    99if install_nonessential_data
    1010        # TODO: install this file somewhere sane
    11         install_data('demo.wav', install_dir: '/')
     11        installed_data += { 'name': 'demo.wav', 'dir': '/' }
    1212endif
  • uspace/drv/bus/isa/meson.build

    r1ef3213 r5852a5a  
    11src = files('i8237.c', 'isa.c')
    22
    3 install_data('ebus.dev', 'isa.dev', install_dir: 'drv' / 'isa')
     3installed_data += [
     4        { 'name': 'ebus.dev', 'dir': 'drv/isa' },
     5        { 'name': 'isa.dev', 'dir': 'drv/isa' },
     6]
  • uspace/drv/nic/ar9271/meson.build

    r1ef3213 r5852a5a  
    88)
    99
    10 install_data('ar9271.fw', install_dir: 'drv' / 'ar9271')
     10installed_data += { 'name': 'ar9271.fw', 'dir': 'drv/ar9271' }
  • uspace/lib/meson.build

    r1ef3213 r5852a5a  
    6363testfiles = []
    6464
     65# Text of the install script.
     66uspace_lib_install_script_text = []
     67uspace_lib_install_depends = []
     68
    6569foreach l : libs
    6670        # Variables that might be defined in library meson files:
  • uspace/meson.build

    r1ef3213 r5852a5a  
    1212subdir('drv')
    1313
     14install_files = []
     15install_deps = []
    1416dirs = []
    1517
     
    4143        # Install driver metadata.
    4244        if not CONFIG_BAREBONE or rd_essential.contains('drv' / drv)
    43                 install_data('drv' / drv / _basename + '.ma', install_dir: 'drv' / _basename)
     45                _src = meson.current_source_dir() / 'drv' / drv / _basename + '.ma'
     46                _dstdir = 'drv' / _basename
     47                install_files += [[ _dstdir, _src, _basename + '.ma' ]]
    4448        endif
    4549endforeach
     
    5559        link_args = []
    5660        language = 'c'
     61        installed_data = []
    5762
    5863        subdir(appdirs.get('subdir'))
     
    6267
    6368        install = not CONFIG_BAREBONE or rd_essential.contains(dir)
     69
     70        if install
     71                # Install data files, if any.
     72                foreach _f : installed_data
     73                        _dstdir = _f.get('dir')
     74                        _src = meson.current_source_dir() / dir / _f.get('name')
     75                        install_files += [[ _dstdir, _src, _f.get('name') ]]
     76                endforeach
     77        endif
    6478
    6579        # basename/dirname will be is useful later.
     
    133147endforeach
    134148
    135 install_script_text = []
    136 
    137149foreach tst : bin_targets
    138150        _ldargs = tst.get('link_args')
     
    145157        _build_name = _full_install_path.underscorify()
    146158        _full_build_name = meson.current_build_dir() / _build_name
    147 
    148         if _install
    149                 # Due to certain quirks of our build, executables need to be built with a different name than what they are installed with.
    150                 # Meson doesn't support renaming installed files (at least not as of mid-2019) so we do it here manually.
    151 
    152                 install_script_text += [
    153                         'mkdir -p ${MESON_INSTALL_DESTDIR_PREFIX}"@0@"'.format(_install_dir),
    154                         'cp "@0@" ${MESON_INSTALL_DESTDIR_PREFIX}"@1@"'.format(_full_build_name, _full_install_path),
    155                 ]
    156 
    157                 if install_debug_files
    158                         install_script_text += [
    159                                 'cp "@0@".disasm ${MESON_INSTALL_DESTDIR_PREFIX}debug/"@1@".disasm'.format(_full_build_name, _full_install_path),
    160                                 'cp "@0@".map ${MESON_INSTALL_DESTDIR_PREFIX}debug/"@1@".map'.format(_full_build_name, _full_install_path)
    161                         ]
    162                 endif
    163         endif
    164159
    165160        if link_map
     
    176171                link_args: arch_uspace_c_args + arch_uspace_link_args + _ldargs,
    177172                implicit_include_directories: false,
    178                 install: false,
    179                 #install_dir: _install_dir,
    180173                build_by_default: true,
    181174        )
    182175
    183176        if disassemble
    184                 custom_target(_build_name + '.disasm',
     177                _disasm = custom_target(_build_name + '.disasm',
    185178                        command: [ objdump, '-S', '@INPUT@' ],
    186179                        input: _bin,
    187180                        output: _build_name + '.disasm',
    188181                        capture: true,
    189                         install: false,
    190                         #install_dir: 'debug' / _install_dir,
    191182                        build_by_default: true,
    192183                )
    193184        endif
    194 endforeach
     185
     186        if _install
     187                # Due to certain quirks of our build, executables need to be built with a different name than what they are installed with.
     188                # Meson doesn't support renaming installed files (at least not as of mid-2019) so we do it manually.
     189
     190                install_files += [[ _install_dir, _full_build_name, _basename ]]
     191                install_deps += [ _bin ]
     192
     193                if install_debug_files
     194                        if disassemble
     195                                install_files += [[ 'debug' / _install_dir, _full_build_name + '.disasm', _basename + '.disasm' ]]
     196                                install_deps += [ _disasm ]
     197                        endif
     198                        if link_map
     199                                install_files += [[ 'debug' / _install_dir, _full_build_name + '.map', _basename + '.map' ]]
     200                        endif
     201                endif
     202        endif
     203endforeach
     204
     205uspace_bin_install_script_text = []
     206
     207foreach f : install_files
     208        _cmd = 'mkdir -p "${MESON_INSTALL_DESTDIR_PREFIX}@0@" && cp -L -T "@1@" "${MESON_INSTALL_DESTDIR_PREFIX}@0@/@2@"'
     209        uspace_bin_install_script_text += _cmd.format(f[0], f[1], f[2])
     210endforeach
     211
     212uspace_install_script_text = uspace_lib_install_script_text + uspace_bin_install_script_text
    195213
    196214# Emit and register the install script.
    197215
    198216configure_file(
    199         configuration: { 'text' : '\n'.join(install_script_text) },
     217        configuration: { 'text' : '\n'.join(uspace_install_script_text) },
    200218        input: 'install.sh.in',
    201219        output: 'install.sh',
Note: See TracChangeset for help on using the changeset viewer.