(en) The thermal corrections to the optical spectra of semiconductors are discussed in terms of the variation of the single electron eigenenergies and the electron-phonon coupling. A formal derivation of the leading Allen-Heine-Cardona theory is presented. This theory is based on standard perturbation theory within the adiabatic, the harmonic and rigid-ion approximations. A full review of the successful application of this theory in the semi-empirical literature is also included. A new ab initio formalism based on DFPT is developed and implemented in the ABINIT package. In this new formulation of the theory of the electron-phonon coupling, the first-order wave functions are determined by a variational principle and are thus not constructed using the unperturbed wave functions. This is in contrast to the Allen-Heine-Cardona theory in which a slow convergence on the number of included states his observed : one must include 2000 states for the correct treatment of H2 and 400 states for silicon. Using the DFPT formalism with only 10 bands yields a decrease in calculation times by a factor of 20. This new implementation of the DFPT formalism was tested using the cases studies of diatomic molecules, silicon and diamond. The results obtained for the diatomic molecules reproduce finite difference calculations up to the numerical error present in the finite difference approach. The procedure reproduces the result of previous semi-empirical studies for silicon but underestimates drastically the electron-phonon coupling in diamond. This is shown to originate from the LDA. Finally, the finite difference method used in the diatomic molecules permitted the direct evaluation of the validity of the rigid-ion approximation by evaluating the non-site-diagonal Debye-Waller term. It was found that this term partially cancels the sum of the site-diagonal Debye-Waller and Fan term. It contributes from 11 % of this sum for CO to 60 % for LiF and is by no means negligible in any system considered. The mismatch between experimental observations and theoretical simulations in crystalline semiconductors is thus believed to originate from this approximation.