Comment 101 for bug 98641

I apologise. I described what my patch did but not why. Here is the full explanation:

A) My changes in the debian/rules:

1)
if [ "$$this_ver" = "$(nv_new_version)" ]; then \

   install $$this_dir/usr/X11R6/lib/modules/libnvidia-wfb.so.$$this_ver \

    $(CURDIR)/debian/nvidia-glx$${nv_flav}/usr/lib/xorg/modules/; \

  fi;

I put if [ "$$this_ver" = "$(nv_new_version)" ] because the latest nvidia driver is the driver which is under development and which therefore will have new features and maybe new modules (and the wfb module is a good example). The 2 legacy drivers will only be maintained and won't have new features implemented. For this reason I think that any new module should be added here (i.e. after 'if [ "$$this_ver" = "$(nv_new_version)" ]; then ').

In my humble opinion it's more flexible than simply relying upon the existence of the wfb module (i.e. if [ -e $$this_dir/usr/X11R6/lib/modules/libnvidia-wfb.so.$$this_ver ]; ) and avoids writing another “if-line” when a new module (other than “wfb”) is added to the driver. My if-line says that if you're building the latest driver you should perform a certain operation.

2)
I changed this part:

 for i in -dev.dirs -dev.links -dev.postinst -dev.postrm \

   -dev.preinst .dirs .docs .examples .links.amd64 \

   .links .override .postinst .postrm .preinst \

   .prerm .README.Debian .reportbug .shlibs; \

 do sed -e "s/@@VERSION@@/$(nv_new_version)/g" -e "s/@@NV_LEGACY@@/-new/g" \

  -e "s:@dirname@:$(nv_new_dirname):" -e "s/@@NV_ALT@@/new/g" \

  < debian/nvidia-glx$$i.in > debian/nvidia-glx-new$$i; \

 done

into:

 for i in -dev.dirs -dev.links -dev.postinst -dev.postrm \

   -dev.preinst .dirs .docs .examples .links.amd64 \

   .links .override .postinst .postrm .preinst \

   .prerm .README.Debian .reportbug .shlibs; \

 do sed -e "s/@@VERSION@@/$(nv_new_version)/g" -e "s/@@NV_LEGACY@@/-new/g" \

  -e "s:@dirname@:$(nv_new_dirname):" -e "s/@@NV_ALT@@/new/g" \

  < debian/nvidia-glx-new$$i.in > debian/nvidia-glx-new$$i; \

 done

Ok, here I changed the “debian/nvidia-glx$$i.in > debian/nvidia-glx-new$$i; “ into “debian/nvidia-glx-new$$i.in > debian/nvidia-glx-new$$i;”

Why? Well (as I will show in the next point) I made a copy of all the nvidia-glx-*.in files and renamed them as nvidia-glx-new*.in. I had to do this for flexibility's sake. In this case the wfb module was added to the driver and I had to add a link to such module in the nvidia-glx-new.links.in and in the nvidia-glx-new.links.amd64.in .

In this way we can keep the links related to the latest driver (nvidia-glx-new) separate from the ones related to the 2 legacy drivers. Otherwise we would have to put the links in the debian/rules but it would break the current way of doing things (e.g. the links for nvidia-glx and nvdia-glx-legacy are listed in the nvidia-glx.links.in and in the nvidia-glx.links.amd64.in and not in the rules file) in the restricted-modules.

B) My changes in the debian/ folder:

1) I made a copy of all the nvidia-glx*.in files and renamed such copies as follows:

nvidia-glx-new.links.in
nvidia-glx-new.override.in
nvidia-glx-new.postinst.in
nvidia-glx-new.postrm.in
nvidia-glx-new.preinst.in
nvidia-glx-new.prerm.in
nvidia-glx-new.README.Debian.in
nvidia-glx-new.reportbug.in
nvidia-glx-new.shlibs.in
nvidia-glx-new-dev.dirs.in
nvidia-glx-new-dev.links.in
nvidia-glx-new-dev.postinst.in
nvidia-glx-new-dev.postrm.in
nvidia-glx-new-dev.preinst.in
nvidia-glx-new.dirs.in
nvidia-glx-new.docs.in
nvidia-glx-new.examples.in
nvidia-glx-new.links.amd64.in

2) I added the following line to the nvidia-glx-new.links.in and to the nvidia-glx-new.links.amd64.in :

usr/lib/xorg/modules/libnvidia-wfb.so.@@VERSION@@ usr/lib/xorg/modules/libwfb.so

So that a link to the wfb module is created. In the future we should put here all the links to the modules needed by the latest driver without touching the links.in files of the legacy drivers (we don't want broken links in the legacy driver, do we?).

My point is that we should keep the whole structure flexible enough in case of changes of the latest Nvidia driver, to which new links and modules might be added.

Having said this, I apologise again for the lack of information as regards my patch.