~ubuntu-branches/ubuntu/vivid/oss4/vivid

« back to all changes in this revision

Viewing changes to setup/dirsetup.c

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis, Samuel Thibault, Romain Beauxis, Sebastien NOEL
  • Date: 2011-06-14 10:06:56 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110614100656-cx4oc7u426zn812z
Tags: 4.2-build2004-1
[ Samuel Thibault ]
* debian/control: Add liboss4-salsa2, liboss4-salsa-dev and
  liboss4-salsa-asound2 packages, equivalent to (and will replace) those from
  the oss-libsalsa package (Closes: #589127).
* debian/patches/liboss4-salsa.patch: New patch to rename libsalsa into
  liboss4-salsa to avoid conflicts in the archive for no good reason.
* debian/rules: Make in libOSSlib and libsalsa.
* debian/liboss4-salsa-dev.install, debian/liboss4-salsa2.install,
  debian/liboss4-salsa-asound2.links, debian/liboss4-salsa-dev.links:
  Install liboss4-salsa libraries like was done in the oss-libsalsa package.
* include-alsa: Add a copy of ALSA 1.0.5 headers: Cf ALSA_1.0.* symbols in
  libsalsa, this is the roughly supported version.
* debian/copyright: Update for new include-alsa files.
* alsa.pc: New file for compatibility with libasound-dev.
* debian/control:
  - Add Vcs-Browser and Vcs-Svn fields.
  - Use linux-any instead of the list of Linux archs (Closes: #604679).
  - Make dkms dependency linux-any only.
* debian/patches/hurd_iot.patch: New patch to fix soundcard.h usage in
  libsalsa on hurd-i386.
* debian/patches/libsalsa_fixes.patch: New patch to fix some printf usages
  and ioctl declaration in libsalsa.
* debian/patches/no_EBADE.patch: New patch to cope with hurd-i386 not having
  EBADE.
* debian/patches/CFLAGS.patch: New patch to make oss4 take debian/rules
  CFLAGS into account.
* debian/patches/snd_asoundlib_version.patch: New patch to add
  snd_asoundlib_version().
* debian/patches/generic_srccconf.patch: New patch to fix source
  configuration on unknown archs.

[ Romain Beauxis ]
* Fixed README.Debian to only mention dkms' modules.
* Switch to dpkg-source 3.0 (quilt) format
* Added DM-Upload-Allowed: yes

[ Sebastien NOEL ]
* New upstream release (Closes: #595298, #619272).
* Fix typo in initscript (Closes: #627149).
* debian/control: adjust linux-headers dependencies (Closes: #628879).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 * This file is part of Open Sound System.
 
4
 *
 
5
 * Copyright (C) 4Front Technologies 1996-2008.
 
6
 *
 
7
 * This this source file is released under GPL v2 license (no other versions).
 
8
 * See the COPYING file included in the main directory of this source
 
9
 * distribution for the license terms and conditions.
 
10
 *
 
11
 */
 
12
 
 
13
#include <stdio.h>
 
14
#include <stdlib.h>
 
15
#include <unistd.h>
 
16
#include <string.h>
 
17
#include <fcntl.h>
 
18
#include <sys/types.h>
 
19
#include <sys/stat.h>
 
20
#include <dirent.h>
 
21
#include <time.h>
 
22
 
 
23
#if PATH_MAX == -1                                      
 
24
#undef PATH_MAX                                           
 
25
#endif
 
26
#ifndef PATH_MAX                                          
 
27
#define PATH_MAX 1024                                     
 
28
#endif
 
29
 
 
30
char *srcdir = NULL, *blddir = NULL;
 
31
int verbose = 0, copy_files = 0;
 
32
struct stat bld_stat, src_stat;
 
33
 
 
34
static void
 
35
copy_file (char *sname, char *tname, char *pname, int native_make)
 
36
{
 
37
  char *p;
 
38
  int in_fd, out_fd, l;
 
39
 
 
40
  unsigned char buf[4096];
 
41
 
 
42
  if (strcmp (pname, ".depend") == 0)
 
43
    return;
 
44
 
 
45
  if (!native_make)
 
46
    if (strncmp (pname, "Makefile", 8) == 0)
 
47
      return;
 
48
 
 
49
  if (strlen (pname) > 6)
 
50
    {
 
51
      p = pname + strlen (pname) - 6;   /* Seek to the _cfg.[c-h] suffix */
 
52
      if (strcmp (p, "_cfg.c") == 0)
 
53
        return;
 
54
      if (strcmp (p, "_cfg.h") == 0)
 
55
        return;
 
56
    }
 
57
 
 
58
  if (!copy_files)
 
59
  {
 
60
     symlink (sname, tname);
 
61
     return;
 
62
  }
 
63
 
 
64
  if ((in_fd=open(sname, O_RDONLY, 0))==-1)
 
65
     {
 
66
             perror(sname);
 
67
             exit(-1);
 
68
     }
 
69
 
 
70
  if ((out_fd=creat(tname, 0644))==-1)
 
71
     {
 
72
             perror(tname);
 
73
             exit(-1);
 
74
     }
 
75
 
 
76
  while ((l=read(in_fd, buf, sizeof(buf)))>0)
 
77
  {
 
78
          if (write(out_fd, buf, l)!=l)
 
79
             {
 
80
                     perror(tname);
 
81
                     exit(-1);
 
82
             }
 
83
  }
 
84
 
 
85
  if (l==-1)
 
86
     {
 
87
             perror(sname);
 
88
             exit(-1);
 
89
     }
 
90
 
 
91
  close(in_fd);
 
92
  close(out_fd);
 
93
}
 
94
 
 
95
static void
 
96
copy_tree (char *fromdir, char *tgtdir, int native_make)
 
97
{
 
98
  DIR *dir;
 
99
  struct dirent *de;
 
100
  struct stat st;
 
101
 
 
102
  if (tgtdir != NULL)
 
103
    {
 
104
      mkdir (tgtdir, 0700);
 
105
    }
 
106
 
 
107
  if ((dir = opendir (fromdir)) == NULL)
 
108
    {
 
109
      fprintf (stderr, "Bad source directory %s\n", fromdir);
 
110
      return;
 
111
    }
 
112
 
 
113
  while ((de = readdir (dir)) != NULL)
 
114
    {
 
115
      char sname[PATH_MAX+20], tname[PATH_MAX+20];
 
116
 
 
117
      sprintf (sname, "%s/%s", fromdir, de->d_name);
 
118
      if (tgtdir != NULL)
 
119
        sprintf (tname, "%s/%s", tgtdir, de->d_name);
 
120
      else
 
121
        sprintf (tname, "%s", de->d_name);
 
122
 
 
123
      if (stat (sname, &st) == -1)
 
124
        {
 
125
          perror (sname);
 
126
          exit (-1);
 
127
        }
 
128
 
 
129
      if ((st.st_dev == bld_stat.st_dev) && (st.st_ino == bld_stat.st_ino)) continue;
 
130
      if ((st.st_dev == src_stat.st_dev) && (st.st_ino == src_stat.st_ino)) continue;
 
131
 
 
132
      if (S_ISDIR (st.st_mode))
 
133
        {
 
134
          if (de->d_name[0] != '.')
 
135
            {
 
136
              char tmp[PATH_MAX+20];
 
137
              int is_native = 0;
 
138
              struct stat st2;
 
139
 
 
140
              sprintf (tmp, "%s/.nativemake", sname);
 
141
              if (stat (tmp, &st2) != -1)
 
142
                is_native = 1;
 
143
 
 
144
              sprintf (tmp, "%s/.nocopy", sname);
 
145
              if (stat (tmp, &st2) == -1)
 
146
                copy_tree (sname, tname, is_native);
 
147
            }
 
148
        }
 
149
      else
 
150
        {
 
151
          copy_file (sname, tname, de->d_name, native_make);
 
152
        }
 
153
    }
 
154
 
 
155
  closedir (dir);
 
156
}
 
157
 
 
158
int
 
159
main (int argc, char *argv[])
 
160
{
 
161
  int i;
 
162
  FILE *f;
 
163
 
 
164
  time_t t;
 
165
  struct tm *tm;
 
166
 
 
167
  if (argc < 3)
 
168
    {
 
169
      fprintf (stderr, "%s: Bad usage\n", argv[0]);
 
170
      exit (-1);
 
171
    }
 
172
 
 
173
  srcdir = argv[1];
 
174
  blddir = argv[2];
 
175
 
 
176
  if (stat (blddir, &bld_stat) == -1)
 
177
    {
 
178
      perror (blddir);
 
179
      exit (-1);
 
180
    }
 
181
 
 
182
  if (stat (srcdir, &src_stat) == -1)
 
183
    {
 
184
      perror (srcdir);
 
185
      exit (-1);
 
186
    }
 
187
 
 
188
  for (i = 3; i < argc; i++)
 
189
    {
 
190
      if (strcmp (argv[i], "-v") == 0)
 
191
        {
 
192
          verbose++;
 
193
          continue;
 
194
        }
 
195
 
 
196
      if (strcmp (argv[i], "-c") == 0)
 
197
        {
 
198
          copy_files = 1;
 
199
          continue;
 
200
        }
 
201
    }
 
202
 
 
203
  f = fopen (".nocopy", "w");
 
204
  fclose (f);
 
205
  copy_tree (srcdir, NULL, 0);
 
206
 
 
207
#if 0
 
208
  if ((f = fopen ("timestamp.h", "w")) == NULL)
 
209
    {
 
210
      perror ("timestamp.h");
 
211
      exit (-1);
 
212
    }
 
213
 
 
214
  time (&t);
 
215
  tm = gmtime (&t);
 
216
  fprintf (f, "#define OSS_COMPILE_DATE \"%04d%02d%02d%02d%02d\"\n",
 
217
           tm->tm_year + 1900,
 
218
           tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min);
 
219
 
 
220
  fclose (f);
 
221
#endif
 
222
 
 
223
  exit (0);
 
224
}