Yes, indeed. If you would want to you can re-compile Debian deb packages from Debian sources. To give you an idea : wiki.debian.org/apt-srcThere’s also Gentoo Linux which has a history of compiling software. Years ago that was interesting because of flags for compiling, make the resulting software optimized for certain CPU models.