Index: uspace/lib/meson.build
===================================================================
--- uspace/lib/meson.build	(revision d63c842e10030ffe5df9ae4361de9ebc1141bf92)
+++ uspace/lib/meson.build	(revision 68b892a5e614d92a0a811d6ecd1a154249190dff)
@@ -65,5 +65,4 @@
 # Text of the install script.
 uspace_lib_install_script_text = []
-uspace_lib_install_depends = []
 
 foreach l : libs
@@ -146,5 +145,4 @@
 	endif
 
-	# TODO: install mapfile if install_debug_data is true
 	mapfile = meson.current_build_dir() / 'lib' + l + '.map'
 
@@ -175,4 +173,6 @@
 	if src.length() > 0
 		if not always_static
+			_libname = 'lib' + l + '.so.' + version.split('.')[0]
+
 			_shared_lib = shared_library(l, src,
 				# TODO: Include private headers using #include "quoted",
@@ -185,10 +185,17 @@
 				version: version,
 				build_by_default: true,
-				install: install_shared_lib,
-				install_dir: 'lib',
 			)
 
+			if install_shared_lib
+				install_files += [[ 'lib', _shared_lib.full_path(), _libname ]]
+				install_deps += [ _shared_lib ]
+			endif
+
+			if install_shared_lib and install_debug_files
+				install_files += [[ 'debug/lib', mapfile, _libname + '.map' ]]
+			endif
+
 			if disassemble
-				custom_target('lib' + l + '.disasm',
+				_disasm = custom_target('lib' + l + '.disasm',
 					command: [ objdump, '-S', '@INPUT@' ],
 					input: _shared_lib,
@@ -196,7 +203,10 @@
 					capture: true,
 					build_by_default: true,
-					install: install_debug_files,
-					install_dir: join_paths('debug', 'lib'),
 				)
+
+				if install_shared_lib and install_debug_files
+					install_files += [[ 'debug/lib', _disasm.full_path(), _libname + '.disasm' ]]
+					install_deps += [ _disasm ]
+				endif
 			endif
 
@@ -217,7 +227,10 @@
 			c_args: arch_uspace_c_args + c_args,
 			cpp_args: arch_uspace_c_args + c_args,
-			install: install_static_lib,
-			install_dir: 'lib',
-		)
+		)
+
+		if install_static_lib
+			install_files += [[ 'lib', _static_lib.full_path(), 'lib' + l + '.a' ]]
+			install_deps += [ _static_lib ]
+		endif
 
 		_static_dep = declare_dependency(
@@ -301,6 +314,4 @@
 		dependencies: [ get_variable('lib' + _libname).get('any'), libpcut.get('any') ],
 		objects: startfiles,
-		install: true,
-		install_dir: 'test',
 		c_args: arch_uspace_c_args,
 		cpp_args: arch_uspace_c_args,
@@ -308,6 +319,9 @@
 	)
 
+	install_files += [[ 'test', _bin.full_path(), _test_binname ]]
+	install_deps += [ _bin ]
+
 	if disassemble
-		custom_target(_test_binname + '.disasm',
+		_disasm = custom_target(_test_binname + '.disasm',
 			command: [ objdump, '-S', '@INPUT@' ],
 			input: _bin,
@@ -317,4 +331,7 @@
 			install_dir: 'debug' / 'test',
 		)
+
+		install_files += [[ 'debug/test', _disasm.full_path(), _test_binname + '.disasm' ]]
+		install_deps += [ _disasm ]
 	endif
 endforeach
